Skip to content

Commit

Permalink
fix: update trademark_disclaimer to allow for new URL
Browse files Browse the repository at this point in the history
In order to account for The Linux Foundation's new `/legal/trademark-usage` route, this regex on line 20 adds an optional `legal/` capture group.

Signed-off-by: Matthew Pereira <[email protected]>
  • Loading branch information
matthewpereira committed Dec 24, 2022
1 parent fb116f9 commit 0c7a74c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion clomonitor-core/src/linter/checks/trademark_disclaimer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) const CHECK_SETS: [CheckSet; 1] = [CheckSet::Community];
lazy_static! {
#[rustfmt::skip]
pub(crate) static ref TRADEMARK_DISCLAIMER: RegexSet = RegexSet::new(vec![
r"https://(?:w{3}\.)?linuxfoundation.org/trademark-usage",
r"https://(?:w{3}\.)?linuxfoundation.org/(?:legal/)?trademark-usage",
r"The Linux Foundation.* has registered trademarks and uses trademarks",
]).expect("exprs in TRADEMARK_DISCLAIMER to be valid");
}
Expand All @@ -45,7 +45,11 @@ mod tests {
#[test]
fn trademark_disclaimer_match() {
assert!(TRADEMARK_DISCLAIMER.is_match("https://www.linuxfoundation.org/trademark-usage"));
assert!(
TRADEMARK_DISCLAIMER.is_match("https://www.linuxfoundation.org/legal/trademark-usage")
);
assert!(TRADEMARK_DISCLAIMER.is_match("https://linuxfoundation.org/trademark-usage"));
assert!(TRADEMARK_DISCLAIMER.is_match("https://linuxfoundation.org/legal/trademark-usage"));
assert!(TRADEMARK_DISCLAIMER.is_match(
"The Linux Foundation® (TLF) has registered trademarks and uses trademarks."
));
Expand Down
2 changes: 1 addition & 1 deletion docs/checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,6 @@ This check passes if:
- The Linux Foundation trademark disclaimer is found in the content of the website configured in Github. Regexps used:
```sh
"https://(?:w{3}\.)?linuxfoundation.org/trademark-usage"
"https://(?:w{3}\.)?linuxfoundation.org/(?:legal/)?trademark-usage"
"The Linux Foundation.* has registered trademarks and uses trademarks"
```

0 comments on commit 0c7a74c

Please sign in to comment.