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
56 changes: 56 additions & 0 deletions scripts/validation/rules/rules-spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,63 @@
format: markdown
errorMessage: Megabytes should be either written as 'megabytes' or abbreviated as
'MB'

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

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

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

# Mbps / Gbps spelling
- regex: "(?<!\\S)\\b\\d+\\s?[mg]bps\\b"
shouldMatch: false
type: warning
format: markdown
errorMessage: 'Megabit per second' should be abbreviated Mbps, 'Gigabit per second' Gbps

# kB / MB spacing
- regex: "(?<!\\S)\\b\\d+[mMkK][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 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.

# μ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
Expand Down