Skip to content

fix: reduce false positives in rules 003, 004, and 400#188

Merged
SecondSkoll merged 1 commit into
canonical:mainfrom
rkratky:rule-fixes
Apr 7, 2026
Merged

fix: reduce false positives in rules 003, 004, and 400#188
SecondSkoll merged 1 commit into
canonical:mainfrom
rkratky:rule-fixes

Conversation

@rkratky
Copy link
Copy Markdown
Contributor

@rkratky rkratky commented Apr 5, 2026

Fixes three sources of false positives discovered while running these rules against ubuntu-project-docs.

Rule 003 — point releases falsely flagged

Ubuntu \d?[02468]\.04(?! LTS) fires on Ubuntu 24.04.4 LTS because after 24.04 the lookahead sees .4, not LTS.

Rule 004 — "Ubuntu Pro" matches "Ubuntu project", "Ubuntu provides", etc.

nonword: true disables implicit word boundaries, so (?<=Ubuntu )Pro matches any word that begins with "pro" after "Ubuntu ". This triggers on valid prose like "Ubuntu project", "Ubuntu provides", "Ubuntu proposed-migration".

Fix: Add an explicit word boundary: (?<=Ubuntu )Pro\b.

Rule 400 — "master" in URL paths

The token masters? fires on "master" inside URL path components (e.g. .../blob/master/README.md) which are not uses of the term.

All existing tests pass and new test cases are added for the 003 and 004 fixes.


Done with Copilot + Claude Sonnet.

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 '(?<!/)' to exclude URL contexts.

Add test cases to manifest.yml for the 003 point-release fix and the
004 Ubuntu Pro word-boundary fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@SecondSkoll SecondSkoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the feedback and PR!

@SecondSkoll SecondSkoll merged commit 246ea1e into canonical:main Apr 7, 2026
3 checks passed
@SecondSkoll SecondSkoll mentioned this pull request Apr 8, 2026
20 tasks
@rkratky rkratky deleted the rule-fixes branch April 9, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants