Skip to content

Commit 91a8fcf

Browse files
authored
feat: various rule enhancements and adjustments (#174)
* feat: fix #153 * fix: rule 010 and add tests * fix: latinism rules level, efficacy, add tests * fix: use EOL token * feat: fix #148 * fix: #146, add tests, adjust level * chore: fix file endings * chore: adjust severity level of rule 008
1 parent 32ffee4 commit 91a8fcf

14 files changed

+319
-94
lines changed

styles/Canonical/005-Industry-product-names.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ extends: substitution
22
message: "Use '%s' instead of '%s'"
33
link: https://docs.ubuntu.com/styleguide/en/#other-commonly-referenced-products/projects
44
ignorecase: true
5-
level: error
5+
level: warning
66
scope:
77
- sentence
88
- list
@@ -20,7 +20,8 @@ swap:
2020
Mysql : 'MySQL'
2121
docker : 'Docker'
2222
KubeFlow : 'Kubeflow'
23-
Google cloud : 'Google Cloud Platform'
23+
Google cloud platform : 'Google Cloud Platform'
24+
Google cloud(?! platform) : 'Google Cloud Platform'
2425
Influxdb : 'InfluxDB'
2526
mattermost : 'Mattermost'
2627

styles/Canonical/007-Headings-sentence-case.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ extends: capitalization
22
# Fork of Google style guide rule
33
message: "'%s' should use sentence-style capitalisation."
44
link: "https://docs.ubuntu.com/styleguide/en/#sentence-case"
5-
level: error
5+
level: warning
66
scope: heading
77
match: $sentence

styles/Canonical/008-Headings-no-period.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ extends: existence
44
message: "Don't use end punctuation in headings."
55
link: https://docs.ubuntu.com/styleguide/en#headings
66
nonword: true
7-
level: warning
7+
level: suggestion
88
scope: heading
99
action:
1010
name: edit
1111
params:
1212
- remove
13-
- '.'
13+
- '[.!?,]'
1414
tokens:
15-
- '[a-z0-9][.](?:\s|$)'
15+
- '[.!?,](?:\s|$)'

styles/Canonical/010-Punctuation-double-spaces.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ message: "'%s' should have one space."
55
link:
66
level: warning
77
scope:
8-
- sentence
9-
- list
8+
- raw
109
nonword: true
1110
tokens:
12-
- '[a-z][.?!] {2,}[A-Z]'
11+
- '[.?!] {2,}$'
1312

1413
# Reasoning:
1514
# We appreciate that you may have been taught to put two spaces after a

styles/Canonical/013-Spell-out-numbers-below-10.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ scope:
77
- sentence
88
- table.header
99
- table.cell
10-
level: warning
10+
level: suggestion
1111
swap:
1212
(?<![\-\.\,:\/*-+#]|Day )0(?![\-\.\,:\/*-+]): zero
1313
(?<![\-\.\,:\/*-+#]|Day )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

styles/Canonical/014a-Numbers-greater-than-nine-should-be-in-numeric-form.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ scope:
88
- table.header
99
- table.cell
1010
ignorecase: true
11-
level: warning
11+
level: suggestion
1212
tokens:
1313
- ten
1414
- eleven

styles/Canonical/014b-Numbers-with-five-or-more-digits-must-have-comma-separators.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ scope:
88
- table.header
99
- table.cell
1010
ignorecase: true
11-
level: warning
11+
level: suggestion
1212
tokens:
1313
- ([\d]{5,})

styles/Canonical/016-No-inline-comments.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ extends: existence
22
message: "Avoid inline comments in code blocks."
33
scope: raw
44
nonword: true
5-
level: warning
5+
level: suggestion
66
tokens:
7-
- ^```[^\n\{\}]*\n(([^\n`][^\n#]*\n|\n))*([^\n#]+ +#.*\n)+([^\n`]*\n)*```
8-
- ^```[^\n\{\}]*\n([^\n`][^\n]*\n|\n)*([^\n\/][^\n\/]+ +\/\/.*\n)+([^\n`]*\n)*```
9-
- '\.\. (code-block|code|sourcecode)::.*\n( {3,}:\w+:\n)*(\s+.* +#.*\n)+'
10-
- '\.\. (code-block|code|sourcecode)::.*\n( {3,}:\w+:\n)*(\s+.* +\/\/.*\n)+'
7+
- ^```[^\n\{\}]*\n(([^\n`][^\n#]*\n|\n))*([^\n#]+ +#.*\n)+([^\n`]*\n)*```$
8+
- ^```[^\n\{\}]*\n([^\n`][^\n]*\n|\n)*([^\n\/][^\n\/]+ +\/\/.*\n)+([^\n`]*\n)*```$
9+
- '\.\. (?:code-block|code|sourcecode):: ?.*\n(?: {3,}:\w+:\n)*(?:\n| {3,}[^\n#]+\n)*( {3,}[^\n]*#[^\n]*\n)(?:\n| {3,}[^\n#]+\n)*'
10+
- '\.\. (?:code-block|code|sourcecode):: ?.*\n(?: {3,}:\w+:\n)*(?:\n| {3,}[^\n\/\/]+\n)*( {3,}[^\n]*\/\/[^\n]*\n)(?:\n| {3,}[^\n\/\/]+\n)*'

styles/Canonical/019-no-google-drive-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ extends: existence
44
message: "Don't use images from Google Drive. Use the asset manager."
55
scope: raw
66
nonword: true
7-
level: warning
7+
level: error
88
tokens:
99
- '!\[[^\n]*\]\([\w\.:\/\-=\? \"]+(drive.google|drive.usercontent.google)[\w\.:\/\-=\? \"]+\)'
1010
- '<[\w\.:\/-=? "]+(drive.google|drive.usercontent.google)[\w\.:\/\-=? "]+>'
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1+
# 025 - Latinisms that have English equivalents
2+
13
extends: substitution
24
message: "Instead of '%[2]s', use %[1]s."
35
link: https://docs.ubuntu.com/styleguide/en#latin-words-and-phrases
4-
level: error
5-
scope:
6-
- sentence
7-
- list
8-
- heading
9-
- table.header
10-
- table.cell
6+
level: suggestion
7+
nonword: true
118
ignorecase: true
12-
swap: # Multiple word terms need to use "this\\sword" to match properly
13-
"a\\spriori": "'self-evident', 'presupposed', 'presumed', or 'assumed'"
9+
swap:
10+
\ba\spriori\b: "'self-evident', 'presupposed', 'presumed', or 'assumed'"
1411
\bad\shoc\b: "'unscheduled', 'unexpected', 'improvised', 'temporary', or 'bespoke'"
1512
\bad\sinfinitum\b: "'and so on', 'to the fullest extent', or 'recursively'"
1613
\bcf\.?\b: "'refer to'"
@@ -24,7 +21,6 @@ swap: # Multiple word terms need to use "this\\sword" to match properly
2421
\b(?:id\sest\b|ie\b|i\.e\.(?!\w)|i\.e(?![\.\w])): "'that is' or 'in other words'"
2522
\bin\ssitu\b: "'in place'"
2623
\b(?:nota\sbene\b|nb\b|n\.b\.(?!\w)|n\.b(?![\.\w])): "'note', 'notice', 'observe', 'pay attention to', or 'keep your eye on'"
27-
\bper\b: "'each', 'every', or 'according to'"
2824
\bper\sdiem\b: "'every day'"
2925
\bper\scapita\b: "'every/each person'"
3026
\bper\sse\b: "'necessarily' or 'intrinsically'"
@@ -34,6 +30,5 @@ swap: # Multiple word terms need to use "this\\sword" to match properly
3430
\bstatus\squo\b: "'state' or 'state of things'"
3531
\bverbatim\b: "'exact words', 'exactly'"
3632
\b(?:versus|vs\.(?!\w)|vs(?![\.\w])): "'compared to/with' or 'opposed to'"
37-
\bvia\b: "'through', 'with', or 'using'"
3833
\bvice\sversa\b: "'the reverse' or 'the other way around'"
39-
\b(?:viz\.(?!\w)|viz(?![\w\.])): "'specifically' or 'namely'"
34+
\b(viz\.(?!\w)|viz(?![\w\.])): "'specifically' or 'namely'"

0 commit comments

Comments
 (0)