Skip to content

Commit bfbe148

Browse files
authored
Merge pull request #98 from arduino/sebromero/spelling-rules
Add rules to find incorrectly formatted units
2 parents b5875ae + 3be447e commit bfbe148

File tree

1 file changed

+72
-3
lines changed

1 file changed

+72
-3
lines changed

scripts/validation/rules/rules-spelling.yml

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,85 @@
33
shouldMatch: false
44
type: warning
55
format: markdown
6-
errorMessage: Megabytes should be either written as 'megabytes' or abbreviated as
7-
'MB'
6+
errorMessage: "Megabytes should be either written as 'megabytes' or abbreviated as 'MB'"
7+
8+
# MHz / GHz / kHz spacing
9+
- regex: "(?<!\\S)\\b\\d+[MmGgk][hH]z\\b"
10+
shouldMatch: false
11+
type: warning
12+
format: markdown
13+
errorMessage: Space between unit and value required
14+
15+
# MHz / GHz spelling
16+
- regex: "(?<!\\S)\\b\\d+\\s?[MmGg]hz\\b"
17+
shouldMatch: false
18+
type: warning
19+
format: markdown
20+
errorMessage: "'Megahertz'/'Gigahertz' should be abbreviated as MHz/GHz"
21+
22+
# kHz spelling
23+
- regex: "(?<!\\S)\\b\\d+\\s?[Kk]hz\\b"
24+
shouldMatch: false
25+
type: warning
26+
format: markdown
27+
errorMessage: "'Kilohertz' should be abbreviated as kHz"
28+
29+
# Mbps / Gbps spacing
30+
- regex: "(?<!\\S)\\b\\d+[MGK]bps\\b"
31+
shouldMatch: false
32+
type: warning
33+
format: markdown
34+
errorMessage: Space between unit and value required
35+
36+
# Kbps / KBps / Mbps / MBps / Gbps / GBps spelling
37+
- regex: "(?<!\\S)\\b\\d+\\s?[kmg][Bb][Pp][Ss]\\b"
38+
shouldMatch: false
39+
type: warning
40+
format: markdown
41+
errorMessage: "Incorrect abbreviation used. Use one of the following: Kbps, KBps, Mbps, MBps, Gbps or GBps (b = bits, B = bytes)"
42+
43+
# kB / KB / Mb / MB / Gb / GB spacing
44+
- regex: "(?<!\\S)\\b\\d+[gBmMkK][bB]\\b"
45+
shouldMatch: false
46+
type: warning
47+
format: markdown
48+
errorMessage: Space between unit and value required
49+
50+
# KB / Kb spelling
51+
- regex: "(?<!\\S)\\b\\d+\\s?k[bB]\\b"
52+
shouldMatch: false
53+
type: warning
54+
format: markdown
55+
errorMessage: "'Kilobyte' should be abbreviated as KB, 'Kilobit' as Kb."
56+
57+
# MB / Mb spelling
58+
- regex: "(?<!\\S)\\b\\d+\\s?m[bB]\\b"
59+
shouldMatch: false
60+
type: warning
61+
format: markdown
62+
errorMessage: "'Megabyte' should be abbreviated as MB, 'Megabit' as Mb."
863

64+
# GB / Gb spelling
65+
- regex: "(?<!\\S)\\b\\d+\\s?g[bB]\\b"
66+
shouldMatch: false
67+
type: warning
68+
format: markdown
69+
errorMessage: "'Gigabyte' should be abbreviated as GB, 'Gigabit' as Gb."
70+
71+
# μm / mm spacing
72+
- regex: "(?<!\\S)\\b\\d+[μm]m\\b"
73+
shouldMatch: false
74+
type: warning
75+
format: markdown
76+
errorMessage: Space between unit and value required
77+
978
# Excludes Wi-Fi in URLs (prepended by dash or slash) and WiFi.XY and MKR WiFi
1079
- regex: "(?<![\\/-]|Arduino |MKR |UNO |MKR 1000 )[wW]i[fF]i(?![-\\/]|\\.?\\S| [sS]hield)"
1180
shouldMatch: false
1281
type: warning
1382
format: markdown
1483
includeCodeBlocks: false
15-
errorMessage: Incorrect spelling of 'Wi-Fi' found.
84+
errorMessage: "Incorrect spelling of 'Wi-Fi' found."
1685

1786
- regex: "(?<!\\/|-)\\b(master|slave)\\b"
1887
regexModifiers: "gi"

0 commit comments

Comments
 (0)