From 0c7a74c6cb8514b0ebf7f713e742277253bb051d Mon Sep 17 00:00:00 2001 From: Administrator Date: Fri, 23 Dec 2022 20:01:54 -0400 Subject: [PATCH] fix: update trademark_disclaimer to allow for new URL 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 --- clomonitor-core/src/linter/checks/trademark_disclaimer.rs | 6 +++++- docs/checks.md | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/clomonitor-core/src/linter/checks/trademark_disclaimer.rs b/clomonitor-core/src/linter/checks/trademark_disclaimer.rs index d5bb2ed4..51f11a17 100644 --- a/clomonitor-core/src/linter/checks/trademark_disclaimer.rs +++ b/clomonitor-core/src/linter/checks/trademark_disclaimer.rs @@ -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"); } @@ -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." )); diff --git a/docs/checks.md b/docs/checks.md index 6acd80cd..6b1cd34a 100644 --- a/docs/checks.md +++ b/docs/checks.md @@ -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" ```