Skip to content

Add rules to find incorrectly formatted units #98

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

Merged
merged 13 commits into from
Apr 14, 2022
75 changes: 72 additions & 3 deletions scripts/validation/rules/rules-spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,85 @@
shouldMatch: false
type: warning
format: markdown
errorMessage: Megabytes should be either written as 'megabytes' or abbreviated as
'MB'
errorMessage: "Megabytes should be either written as 'megabytes' or abbreviated as 'MB'"

# MHz / GHz / kHz spacing
- regex: "(?<!\\S)\\b\\d+[MmGgk][hH]z\\b"
shouldMatch: false
type: warning
format: markdown
errorMessage: Space between unit and value required

# MHz / GHz spelling
- regex: "(?<!\\S)\\b\\d+\\s?[MmGg]hz\\b"
shouldMatch: false
type: warning
format: markdown
errorMessage: "'Megahertz'/'Gigahertz' should be abbreviated as MHz/GHz"

# kHz spelling
- regex: "(?<!\\S)\\b\\d+\\s?[Kk]hz\\b"
shouldMatch: false
type: warning
format: markdown
errorMessage: "'Kilohertz' should be abbreviated as kHz"

# Mbps / Gbps spacing
- regex: "(?<!\\S)\\b\\d+[MGK]bps\\b"
shouldMatch: false
type: warning
format: markdown
errorMessage: Space between unit and value required

# Kbps / KBps / Mbps / MBps / Gbps / GBps spelling
- regex: "(?<!\\S)\\b\\d+\\s?[kmg][Bb][Pp][Ss]\\b"
shouldMatch: false
type: warning
format: markdown
errorMessage: "Incorrect abbreviation used. Use one of the following: Kbps, KBps, Mbps, MBps, Gbps or GBps (b = bits, B = bytes)"

# kB / KB / Mb / MB / Gb / GB spacing
- regex: "(?<!\\S)\\b\\d+[gBmMkK][bB]\\b"
shouldMatch: false
type: warning
format: markdown
errorMessage: Space between unit and value required

# KB / Kb spelling
- regex: "(?<!\\S)\\b\\d+\\s?k[bB]\\b"
shouldMatch: false
type: warning
format: markdown
errorMessage: "'Kilobyte' should be abbreviated as KB, 'Kilobit' as Kb."

# MB / Mb spelling
- regex: "(?<!\\S)\\b\\d+\\s?m[bB]\\b"
shouldMatch: false
type: warning
format: markdown
errorMessage: "'Megabyte' should be abbreviated as MB, 'Megabit' as Mb."

# GB / Gb spelling
- regex: "(?<!\\S)\\b\\d+\\s?g[bB]\\b"
shouldMatch: false
type: warning
format: markdown
errorMessage: "'Gigabyte' should be abbreviated as GB, 'Gigabit' as Gb."

# μm / mm spacing
- regex: "(?<!\\S)\\b\\d+[μm]m\\b"
shouldMatch: false
type: warning
format: markdown
errorMessage: Space between unit and value required

# Excludes Wi-Fi in URLs (prepended by dash or slash) and WiFi.XY and MKR WiFi
- regex: "(?<![\\/-]|Arduino |MKR |UNO |MKR 1000 )[wW]i[fF]i(?![-\\/]|\\.?\\S| [sS]hield)"
shouldMatch: false
type: warning
format: markdown
includeCodeBlocks: false
errorMessage: Incorrect spelling of 'Wi-Fi' found.
errorMessage: "Incorrect spelling of 'Wi-Fi' found."

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