Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule 13 - Spell numbers: make exclusions work again #64

Open
izmalk opened this issue Jul 20, 2024 · 0 comments
Open

Rule 13 - Spell numbers: make exclusions work again #64

izmalk opened this issue Jul 20, 2024 · 0 comments

Comments

@izmalk
Copy link
Contributor

izmalk commented Jul 20, 2024

I'm trying to add an exclusion to the rule Rule#13 for the Day 0, Day 1, and Day 2 can be spelled with numbers as in the Software development lifecycle terminology.

Most of my attempts so far were unsuccessful:

I managed to achieve the desired effect by modifying the regular expression in the Rule:

extends: substitution
message: "Consider using '%s' instead of '%s'"
link: https://docs.ubuntu.com/styleguide/en#numbers
scope:
  - heading
  - list
  - sentence
  - table.header
  - table.cell
level: warning
swap:
  (?<![\-\.\,:\/*-+]|day\s)0(?![\-\.\,:\/*-+]): zero
  (?<![\-\.\,:\/*-+]|day\s)1(?![\-\.\,:\/*-+])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): one
  (?<![\-\.\,:\/*-+]|day\s)2(?![\-\.\,:\/*-+])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): two
  (?<![\-\.\,:\/*-+])3(?![\-\.\,:\/*-+])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): three
  (?<![\-\.\,:\/*-+])4(?![\-\.\,:\/*-+])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): four
  (?<![\-\.\,:\/*-+])5(?![\-\.\,:\/*-+])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): five
  (?<![\-\.\,:\/*-+])6(?![\-\.\,:\/*-+])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): six
  (?<![\-\.\,:\/*-+])7(?![\-\.\,:\/*-+])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): seven
  (?<![\-\.\,:\/*-+])8(?![\-\.\,:\/*-+])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): eight
  (?<![\-\.\,:\/*-+])9(?![\-\.\,:\/*-+])(?! Jan(?!uary)?| Feb(?!ruary)?| Mar(?!ch)?| Apr(?!il)?| May| Jun(?:e)?| Jul(?:y)?| Aug(?:ust)?| Sep(?:tember)?| Oct(?:ober)?| Nov(?:ember)?| Dec(?:ember)?): nine

But I feel like this is too hacky and I'd prefer to have the exceptions or accept.txt to work for this narrow case.

@izmalk izmalk changed the title Rule 13 Spell numbers: make exclusions work again Rule 13 - Spell numbers: make exclusions work again Jul 20, 2024
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

No branches or pull requests

1 participant