From ab0e040fac650098dedec7a8854446d37bc0790f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Kr=C3=A1tk=C3=BD?= Date: Sun, 5 Apr 2026 19:53:47 +0200 Subject: [PATCH] fix: reduce false positives in rules 003, 004, and 400 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rule 003 (Ubuntu-names-versions): extend the LTS lookahead to also accept point releases. The pattern 'Ubuntu \d?[02468]\.04(?! LTS)' incorrectly flags 'Ubuntu 24.04.4 LTS' because after '24.04' comes '.4', not ' LTS'. Change to '(?!\.\d| LTS)' to allow both. Rule 004 (Canonical-product-names): add explicit word boundary to the Ubuntu Pro pattern. 'nonword: true' means Vale does not add implicit word boundaries, so '(?<=Ubuntu )Pro' matches any word starting with 'pro' after 'Ubuntu' — e.g. 'Ubuntu project', 'Ubuntu provides'. Change to '(?<=Ubuntu )Pro\b' to match only the whole word 'Pro'. Rule 400 (Enforce-inclusive-terms): exclude 'master' in URL path segments. The token 'masters?' fires on 'master' inside URL paths (e.g. '.../blob/master/README.md') which are not actual uses of the term. Add a negative lookbehind '(? --- styles/Canonical/003-Ubuntu-names-versions.yml | 5 +++-- styles/Canonical/004-Canonical-product-names.yml | 3 ++- styles/Canonical/400-Enforce-inclusive-terms.yml | 2 +- tests/data/manifest.yml | 14 ++++++++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/styles/Canonical/003-Ubuntu-names-versions.yml b/styles/Canonical/003-Ubuntu-names-versions.yml index 79bbb90..1f1e023 100644 --- a/styles/Canonical/003-Ubuntu-names-versions.yml +++ b/styles/Canonical/003-Ubuntu-names-versions.yml @@ -16,8 +16,9 @@ scope: level: error tokens: # LTS releases should be followed by "LTS" suffix. - - 'Ubuntu \d?[02468]\.04(?! LTS)' - - 'Ubuntu 6\.06(?! LTS)' + # Use (?!\.\d| LTS) so point releases like "Ubuntu 24.04.4 LTS" are not flagged. + - 'Ubuntu \d?[02468]\.04(?!\.\d| LTS)' + - 'Ubuntu 6\.06(?!\.\d| LTS)' # Non-LTS releases should not be followed by "LTS" suffix. - 'Ubuntu \d?\d\.10 LTS' - 'Ubuntu \d?[13579]\.04 LTS' diff --git a/styles/Canonical/004-Canonical-product-names.yml b/styles/Canonical/004-Canonical-product-names.yml index 06fc941..cc1e24a 100644 --- a/styles/Canonical/004-Canonical-product-names.yml +++ b/styles/Canonical/004-Canonical-product-names.yml @@ -31,7 +31,8 @@ swap: Snapcraft: Snapcraft snapd: snapd # Vale seems to allow normal capitalisation, may need specific existence rule for Snapd Ubuntu Core: Ubuntu Core - (?<=Ubuntu )Pro: Pro + # \b ensures only "Ubuntu Pro" matches, not "Ubuntu project", "Ubuntu provides", etc. + (?<=Ubuntu )Pro\b: Pro Ubuntu Server: Ubuntu Server # Not working with multi-word terms that have the first word in the accept list diff --git a/styles/Canonical/400-Enforce-inclusive-terms.yml b/styles/Canonical/400-Enforce-inclusive-terms.yml index da8839b..4af4b6b 100644 --- a/styles/Canonical/400-Enforce-inclusive-terms.yml +++ b/styles/Canonical/400-Enforce-inclusive-terms.yml @@ -14,7 +14,7 @@ tokens: - black( )?hats? - white( )?hats? - illegal characters? - - masters? + - (?