diff options
Diffstat (limited to 'ci')
36 files changed, 0 insertions, 773 deletions
diff --git a/ci/vale/Google/AMPM.yml b/ci/vale/Google/AMPM.yml deleted file mode 100644 index fbdc6e4f..00000000 --- a/ci/vale/Google/AMPM.yml +++ /dev/null @@ -1,9 +0,0 @@ -extends: existence -message: "Use 'AM' or 'PM' (preceded by a space)." -link: 'https://developers.google.com/style/word-list' -level: error -nonword: true -tokens: - - '\d{1,2}[AP]M' - - '\d{1,2} ?[ap]m' - - '\d{1,2} ?[aApP]\.[mM]\.' diff --git a/ci/vale/Google/Acronyms.yml b/ci/vale/Google/Acronyms.yml deleted file mode 100644 index f41af018..00000000 --- a/ci/vale/Google/Acronyms.yml +++ /dev/null @@ -1,64 +0,0 @@ -extends: conditional -message: "Spell out '%s', if it's unfamiliar to the audience." -link: 'https://developers.google.com/style/abbreviations' -level: suggestion -ignorecase: false -# Ensures that the existence of 'first' implies the existence of 'second'. -first: '\b([A-Z]{3,5})\b' -second: '(?:\b[A-Z][a-z]+ )+\(([A-Z]{3,5})\)' -# ... with the exception of these: -exceptions: - - API - - ASP - - CLI - - CPU - - CSS - - CSV - - DEBUG - - DOM - - DPI - - FAQ - - GCC - - GDB - - GET - - GPU - - GTK - - GUI - - HTML - - HTTP - - HTTPS - - IDE - - JAR - - JSON - - JSX - - LESS - - LLDB - - NET - - NOTE - - NVDA - - OSS - - PATH - - PDF - - PHP - - POST - - RAM - - REPL - - RSA - - SCM - - SCSS - - SDK - - SQL - - SSH - - SSL - - SVG - - TBD - - TCP - - TODO - - URI - - URL - - USB - - UTF - - XML - - XSS - - YAML - - ZIP diff --git a/ci/vale/Google/Colons.yml b/ci/vale/Google/Colons.yml deleted file mode 100644 index 9a4b4b4a..00000000 --- a/ci/vale/Google/Colons.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "'%s' should be in lowercase." -link: 'https://developers.google.com/style/colons' -nonword: true -level: warning -tokens: - - ':\s[A-Z]' diff --git a/ci/vale/Google/Contractions.yml b/ci/vale/Google/Contractions.yml deleted file mode 100644 index 905a39f4..00000000 --- a/ci/vale/Google/Contractions.yml +++ /dev/null @@ -1,28 +0,0 @@ -extends: substitution -message: "Feel free to use '%s' instead of '%s'." -link: 'https://developers.google.com/style/contractions' -level: suggestion -ignorecase: true -swap: - are not: aren't - cannot: can't - could not: couldn't - did not: didn't - do not: don't - does not: doesn't - has not: hasn't - have not: haven't - how is: how's - is not: isn't - it is: it's - should not: shouldn't - that is: that's - they are: they're - was not: wasn't - we are: we're - we have: we've - were not: weren't - what is: what's - when is: when's - where is: where's - will not: won't diff --git a/ci/vale/Google/DateFormat.yml b/ci/vale/Google/DateFormat.yml deleted file mode 100644 index e9d227fa..00000000 --- a/ci/vale/Google/DateFormat.yml +++ /dev/null @@ -1,9 +0,0 @@ -extends: existence -message: "Use 'July 31, 2016' format, not '%s'." -link: 'https://developers.google.com/style/dates-times' -ignorecase: true -level: error -nonword: true -tokens: - - '\d{1,2}(?:\.|/)\d{1,2}(?:\.|/)\d{4}' - - '\d{1,2} (?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)|May|Jun(?:e)|Jul(?:y)|Aug(?:ust)|Sep(?:tember)?|Oct(?:ober)|Nov(?:ember)?|Dec(?:ember)?) \d{4}' diff --git a/ci/vale/Google/Ellipses.yml b/ci/vale/Google/Ellipses.yml deleted file mode 100644 index 436e6177..00000000 --- a/ci/vale/Google/Ellipses.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "In general, don't use an ellipsis." -link: 'https://developers.google.com/style/ellipses' -nonword: true -level: warning -tokens: - - '\.\.\.' diff --git a/ci/vale/Google/EmDash.yml b/ci/vale/Google/EmDash.yml deleted file mode 100644 index c6018db1..00000000 --- a/ci/vale/Google/EmDash.yml +++ /dev/null @@ -1,8 +0,0 @@ -extends: existence -message: "Don't put a space before or after an em dash." -link: 'https://developers.google.com/style/dashes' -nonword: true -level: error -tokens: - - '\s—' - - '—\s' diff --git a/ci/vale/Google/EnDash.yml b/ci/vale/Google/EnDash.yml deleted file mode 100644 index 194876aa..00000000 --- a/ci/vale/Google/EnDash.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Use an em dash ('—') instead of '–'." -link: 'https://developers.google.com/style/dashes' -nonword: true -level: error -tokens: - - '–' diff --git a/ci/vale/Google/Exclamation.yml b/ci/vale/Google/Exclamation.yml deleted file mode 100644 index c4db380b..00000000 --- a/ci/vale/Google/Exclamation.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Don't use exclamation points in text." -link: 'https://developers.google.com/style/exclamation-points' -nonword: true -level: error -tokens: - - '!' diff --git a/ci/vale/Google/FirstPerson.yml b/ci/vale/Google/FirstPerson.yml deleted file mode 100644 index d2290611..00000000 --- a/ci/vale/Google/FirstPerson.yml +++ /dev/null @@ -1,11 +0,0 @@ -extends: existence -message: "Avoid first-person pronouns such as '%s'." -link: 'https://developers.google.com/style/pronouns#personal-pronouns' -ignorecase: true -level: warning -nonword: true -tokens: - - (?:^|\s)I\s - - \bme\b - - \bus\b - - \bours\b diff --git a/ci/vale/Google/Gender.yml b/ci/vale/Google/Gender.yml deleted file mode 100644 index c8486181..00000000 --- a/ci/vale/Google/Gender.yml +++ /dev/null @@ -1,9 +0,0 @@ -extends: existence -message: "Don't use '%s' as a gender-neutral pronoun." -link: 'https://developers.google.com/style/pronouns#gender-neutral-pronouns' -level: error -ignorecase: true -tokens: - - he/she - - s/he - - \(s\)he diff --git a/ci/vale/Google/GenderBias.yml b/ci/vale/Google/GenderBias.yml deleted file mode 100644 index 261cfb66..00000000 --- a/ci/vale/Google/GenderBias.yml +++ /dev/null @@ -1,45 +0,0 @@ -extends: substitution -message: "Consider using '%s' instead of '%s'." -link: 'https://developers.google.com/style/inclusive-documentation' -ignorecase: true -level: error -swap: - (?:alumna|alumnus): graduate - (?:alumnae|alumni): graduates - air(?:m[ae]n|wom[ae]n): pilot(s) - anchor(?:m[ae]n|wom[ae]n): anchor(s) - authoress: author - camera(?:m[ae]n|wom[ae]n): camera operator(s) - chair(?:m[ae]n|wom[ae]n): chair(s) - congress(?:m[ae]n|wom[ae]n): member(s) of congress - door(?:m[ae]|wom[ae]n): concierge(s) - draft(?:m[ae]n|wom[ae]n): drafter(s) - fire(?:m[ae]n|wom[ae]n): firefighter(s) - fisher(?:m[ae]n|wom[ae]n): fisher(s) - fresh(?:m[ae]n|wom[ae]n): first-year student(s) - garbage(?:m[ae]n|wom[ae]n): waste collector(s) - lady lawyer: lawyer - ladylike: courteous - landlord: building manager - mail(?:m[ae]n|wom[ae]n): mail carriers - man and wife: husband and wife - man enough: strong enough - mankind: human kind - manmade: manufactured - manpower: personnel - men and girls: men and women - middle(?:m[ae]n|wom[ae]n): intermediary - news(?:m[ae]n|wom[ae]n): journalist(s) - ombuds(?:man|woman): ombuds - oneupmanship: upstaging - poetess: poet - police(?:m[ae]n|wom[ae]n): police officer(s) - repair(?:m[ae]n|wom[ae]n): technician(s) - sales(?:m[ae]n|wom[ae]n): salesperson or sales people - service(?:m[ae]n|wom[ae]n): soldier(s) - steward(?:ess)?: flight attendant - tribes(?:m[ae]n|wom[ae]n): tribe member(s) - waitress: waiter - woman doctor: doctor - woman scientist[s]?: scientist(s) - work(?:m[ae]n|wom[ae]n): worker(s) diff --git a/ci/vale/Google/HeadingPunctuation.yml b/ci/vale/Google/HeadingPunctuation.yml deleted file mode 100644 index 5c39abbf..00000000 --- a/ci/vale/Google/HeadingPunctuation.yml +++ /dev/null @@ -1,8 +0,0 @@ -extends: existence -message: "Don't put a period at the end of a heading." -link: 'https://developers.google.com/style/capitalization#capitalization-in-titles-and-headings' -nonword: true -level: warning -scope: heading -tokens: - - '[a-z0-9][.](?:\s|$)' diff --git a/ci/vale/Google/Headings.yml b/ci/vale/Google/Headings.yml deleted file mode 100644 index 5afb968d..00000000 --- a/ci/vale/Google/Headings.yml +++ /dev/null @@ -1,26 +0,0 @@ -extends: capitalization -message: "'%s' should use sentence-style capitalization." -link: 'https://developers.google.com/style/capitalization#capitalization-in-titles-and-headings' -level: warning -scope: heading -match: $sentence -exceptions: - - Azure - - CLI - - Code - - Cosmos - - Docker - - Emmet - - I - - Kubernetes - - Linux - - macOS - - Marketplace - - MongoDB - - REPL - - Studio - - TypeScript - - URLs - - Visual - - VS - - Windows diff --git a/ci/vale/Google/Hyphens.yml b/ci/vale/Google/Hyphens.yml deleted file mode 100644 index f9779637..00000000 --- a/ci/vale/Google/Hyphens.yml +++ /dev/null @@ -1,8 +0,0 @@ -extends: existence -message: "Don't place a space on either side of a hyphen (unless it's suspended)." -link: 'https://developers.google.com/style/hyphens' -level: warning -nonword: true -tokens: - - '\s-' - - '-\s' diff --git a/ci/vale/Google/Latin.yml b/ci/vale/Google/Latin.yml deleted file mode 100644 index f032b349..00000000 --- a/ci/vale/Google/Latin.yml +++ /dev/null @@ -1,9 +0,0 @@ -extends: substitution -message: "Use '%s' instead of '%s'." -link: 'https://developers.google.com/style/abbreviations' -ignorecase: true -level: error -nonword: true -swap: - '\b(?:eg|e\.g\.)[\s,]': for example - '\b(?:ie|i\.e\.)[\s,]': that is diff --git a/ci/vale/Google/LyHyphens.yml b/ci/vale/Google/LyHyphens.yml deleted file mode 100644 index d5b6a942..00000000 --- a/ci/vale/Google/LyHyphens.yml +++ /dev/null @@ -1,8 +0,0 @@ -extends: existence -message: "'%s' doesn't need a hyphen." -link: 'https://developers.google.com/style/hyphens' -level: error -ignorecase: false -nonword: true -tokens: - - '\s[^\s-]+ly-' diff --git a/ci/vale/Google/OptionalPlurals.yml b/ci/vale/Google/OptionalPlurals.yml deleted file mode 100644 index 7058932f..00000000 --- a/ci/vale/Google/OptionalPlurals.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Don't use plurals in parentheses such as in '%s'." -link: 'https://developers.google.com/style/plurals-parentheses' -level: error -nonword: true -tokens: - - '\b\w+\(s\)' diff --git a/ci/vale/Google/Ordinal.yml b/ci/vale/Google/Ordinal.yml deleted file mode 100644 index 8c429e0f..00000000 --- a/ci/vale/Google/Ordinal.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Spell out all ordinal numbers ('%s') in text." -link: 'https://developers.google.com/style/numbers' -level: error -nonword: true -tokens: - - \d+(?:st|th|rd) diff --git a/ci/vale/Google/OxfordComma.yml b/ci/vale/Google/OxfordComma.yml deleted file mode 100644 index 98b07113..00000000 --- a/ci/vale/Google/OxfordComma.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Use the Oxford comma in '%s'." -link: 'https://developers.google.com/style/commas' -scope: sentence -level: warning -tokens: - - '(?:[^,]+,){1,}\s\w+\sand' diff --git a/ci/vale/Google/Parens.yml b/ci/vale/Google/Parens.yml deleted file mode 100644 index 3b8711d0..00000000 --- a/ci/vale/Google/Parens.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Use parentheses judiciously." -link: 'https://developers.google.com/style/parentheses' -nonword: true -level: suggestion -tokens: - - '\(.+\)' diff --git a/ci/vale/Google/Passive.yml b/ci/vale/Google/Passive.yml deleted file mode 100644 index 3265890e..00000000 --- a/ci/vale/Google/Passive.yml +++ /dev/null @@ -1,184 +0,0 @@ -extends: existence -link: 'https://developers.google.com/style/voice' -message: "In general, use active voice instead of passive voice ('%s')." -ignorecase: true -level: suggestion -raw: - - \b(am|are|were|being|is|been|was|be)\b\s* -tokens: - - '[\w]+ed' - - awoken - - beat - - become - - been - - begun - - bent - - beset - - bet - - bid - - bidden - - bitten - - bled - - blown - - born - - bought - - bound - - bred - - broadcast - - broken - - brought - - built - - burnt - - burst - - cast - - caught - - chosen - - clung - - come - - cost - - crept - - cut - - dealt - - dived - - done - - drawn - - dreamt - - driven - - drunk - - dug - - eaten - - fallen - - fed - - felt - - fit - - fled - - flown - - flung - - forbidden - - foregone - - forgiven - - forgotten - - forsaken - - fought - - found - - frozen - - given - - gone - - gotten - - ground - - grown - - heard - - held - - hidden - - hit - - hung - - hurt - - kept - - knelt - - knit - - known - - laid - - lain - - leapt - - learnt - - led - - left - - lent - - let - - lighted - - lost - - made - - meant - - met - - misspelt - - mistaken - - mown - - overcome - - overdone - - overtaken - - overthrown - - paid - - pled - - proven - - put - - quit - - read - - rid - - ridden - - risen - - run - - rung - - said - - sat - - sawn - - seen - - sent - - set - - sewn - - shaken - - shaven - - shed - - shod - - shone - - shorn - - shot - - shown - - shrunk - - shut - - slain - - slept - - slid - - slit - - slung - - smitten - - sold - - sought - - sown - - sped - - spent - - spilt - - spit - - split - - spoken - - spread - - sprung - - spun - - stolen - - stood - - stridden - - striven - - struck - - strung - - stuck - - stung - - stunk - - sung - - sunk - - swept - - swollen - - sworn - - swum - - swung - - taken - - taught - - thought - - thrived - - thrown - - thrust - - told - - torn - - trodden - - understood - - upheld - - upset - - wed - - wept - - withheld - - withstood - - woken - - won - - worn - - wound - - woven - - written - - wrung diff --git a/ci/vale/Google/Periods.yml b/ci/vale/Google/Periods.yml deleted file mode 100644 index d24a6a6c..00000000 --- a/ci/vale/Google/Periods.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Don't use periods with acronyms or initialisms such as '%s'." -link: 'https://developers.google.com/style/abbreviations' -level: error -nonword: true -tokens: - - '\b(?:[A-Z]\.){3,}' diff --git a/ci/vale/Google/Quotes.yml b/ci/vale/Google/Quotes.yml deleted file mode 100644 index 3cb6f1ab..00000000 --- a/ci/vale/Google/Quotes.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Commas and periods go inside quotation marks." -link: 'https://developers.google.com/style/quotation-marks' -level: error -nonword: true -tokens: - - '"[^"]+"[.,?]' diff --git a/ci/vale/Google/Ranges.yml b/ci/vale/Google/Ranges.yml deleted file mode 100644 index 3ec045e7..00000000 --- a/ci/vale/Google/Ranges.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Don't add words such as 'from' or 'between' to describe a range of numbers." -link: 'https://developers.google.com/style/hyphens' -nonword: true -level: warning -tokens: - - '(?:from|between)\s\d+\s?-\s?\d+' diff --git a/ci/vale/Google/Semicolons.yml b/ci/vale/Google/Semicolons.yml deleted file mode 100644 index bb8b85b4..00000000 --- a/ci/vale/Google/Semicolons.yml +++ /dev/null @@ -1,8 +0,0 @@ -extends: existence -message: "Use semicolons judiciously." -link: 'https://developers.google.com/style/semicolons' -nonword: true -scope: sentence -level: suggestion -tokens: - - ';' diff --git a/ci/vale/Google/Slang.yml b/ci/vale/Google/Slang.yml deleted file mode 100644 index 63f4c248..00000000 --- a/ci/vale/Google/Slang.yml +++ /dev/null @@ -1,11 +0,0 @@ -extends: existence -message: "Don't use internet slang abbreviations such as '%s'." -link: 'https://developers.google.com/style/abbreviations' -ignorecase: true -level: error -tokens: - - 'tl;dr' - - ymmv - - rtfm - - imo - - fwiw diff --git a/ci/vale/Google/Spacing.yml b/ci/vale/Google/Spacing.yml deleted file mode 100644 index 5f209a9f..00000000 --- a/ci/vale/Google/Spacing.yml +++ /dev/null @@ -1,8 +0,0 @@ -extends: existence -message: "'%s' should have one space." -link: 'https://developers.google.com/style/sentence-spacing' -level: error -nonword: true -tokens: - - '[.?!] {2,}[A-Z]' - - '[.?!][A-Z]' diff --git a/ci/vale/Google/Spelling.yml b/ci/vale/Google/Spelling.yml deleted file mode 100644 index 57acb884..00000000 --- a/ci/vale/Google/Spelling.yml +++ /dev/null @@ -1,8 +0,0 @@ -extends: existence -message: "In general, use American spelling instead of '%s'." -link: 'https://developers.google.com/style/spelling' -ignorecase: true -level: warning -tokens: - - '(?:\w+)nised?' - - '(?:\w+)logue' diff --git a/ci/vale/Google/Units.yml b/ci/vale/Google/Units.yml deleted file mode 100644 index 220de3e9..00000000 --- a/ci/vale/Google/Units.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Put a nonbreaking space between the number and the unit in '%s'." -link: 'https://developers.google.com/style/units-of-measure' -nonword: true -level: error -tokens: - - \d+(?:GB|TB|MB) diff --git a/ci/vale/Google/Will.yml b/ci/vale/Google/Will.yml deleted file mode 100644 index 128a9183..00000000 --- a/ci/vale/Google/Will.yml +++ /dev/null @@ -1,7 +0,0 @@ -extends: existence -message: "Avoid using '%s'." -link: 'https://developers.google.com/style/tense' -ignorecase: true -level: warning -tokens: - - will diff --git a/ci/vale/Google/WordList.yml b/ci/vale/Google/WordList.yml deleted file mode 100644 index d5d6bea5..00000000 --- a/ci/vale/Google/WordList.yml +++ /dev/null @@ -1,79 +0,0 @@ -extends: substitution -message: "Use %s instead of '%s'." -link: 'https://developers.google.com/style/word-list' -level: warning -ignorecase: false -swap: - '(?:API Console|dev|developer) key': "'API key'" - '(?:cell ?phone|smart ?phone)': "'phone' or 'mobile phone'" - '(?:dev|developer|APIs) console': "'API console'" - '(?:e-mail|Email|E-mail)': "'email'" - '(?:file ?path|path ?name)': "'path'" - '(?:kill|terminate)': "'stop', 'exit', 'cancel', or 'end'" - '(?:OAuth ?2|Oauth)': "'OAuth 2.0'" - '(?:ok|Okay)': "'OK' or 'okay'" - '(?:WiFi|wifi)': "'Wi-Fi'" - '[\.]+apk': "'APK'" - '3\-D': "'3D'" - 'Google (?:I\-O|IO)': "'Google I/O'" - 'tap (?:&|and) hold': "'touch & hold'" - 'un(?:check|select)': "'clear'" - abort: "'stop', 'exit', 'cancel' or 'end'" - above: "'preceding'" - account name: "'username'" - action bar: "'app bar'" - admin: "'administrator'" - Ajax: "'AJAX'" - Android device: "'Android-powered device'" - android: "'Android'" - API explorer: "'APIs Explorer'" - application: "'app'" - approx\.: "'approximately'" - authN: "'authentication'" - authZ: "'authorization'" - autoupdate: "'automatically update'" - cellular data: "'mobile data'" - cellular network: "'mobile network'" - chapter: "'documents', 'pages', 'sections'" - check box: "'checkbox'" - check: "'select'" - CLI: "'command-line tool'" - click on: "'click' or 'click in'" - Cloud: "'Google Cloud Platform' or 'GCP'" - Container Engine: "'Kubernetes Engine'" - content type: "'media type'" - curated roles: "'predefined roles'" - data are: "'data is'" - Developers Console: "'Google API Console' or 'API Console'" - disabled?: "'turn off' or 'off'" - ephemeral IP address: "'ephemeral external IP address'" - fewer data: "'less data'" - file name: "'filename'" - firewalls: "'firewall rules'" - functionality: "'capability' or 'feature'" - Google account: "'Google Account'" - Google accounts: "'Google Accounts'" - Googling: "'search with Google'" - grayed-out: "'unavailable'" - HTTPs: "'HTTPS'" - in order to: "'to'" - ingest: "'import' or 'load'" - k8s: "'Kubernetes'" - long press: "'touch & hold'" - network IP address: "'internal IP address'" - omnibox: "'address bar'" - open-source: "'open source'" - overview screen: "'recents screen'" - regex: "'regular expression'" - SHA1: "'SHA-1' or 'HAS-SHA1'" - sign into: "'sign in to'" - sign-?on: "'single sign-on'" - static IP address: "'static external IP address'" - stylesheet: "'style sheet'" - synch: "'sync'" - tablename: "'table name'" - tablet: "'device'" - touch: "'tap'" - url: "'URL'" - vs\.: "'versus'" - World Wide Web: "'web'" diff --git a/ci/vale/Google/meta.json b/ci/vale/Google/meta.json deleted file mode 100644 index 3ae5fb21..00000000 --- a/ci/vale/Google/meta.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "author": "Joseph Kato", - "description": "A Vale-compatible implementation of the Microsoft Writing Style Guide.", - "email": "support@errata.ai", - "lang": "en", - "url": "https://github.com/errata-ai/Google/releases/latest/download/Google.zip", - "feed": "https://github.com/errata-ai/Google/releases.atom", - "issues": "https://github.com/errata-ai/Google/issues/new", - "license": "MIT", - "name": "Google", - "sources": [ - "https://developers.google.com/style/" - ], - "vale_version": ">=1.0.0", - "coverage": 0.0 -} diff --git a/ci/vale/Google/vocab.txt b/ci/vale/Google/vocab.txt deleted file mode 100644 index e69de29b..00000000 --- a/ci/vale/Google/vocab.txt +++ /dev/null diff --git a/ci/vale/VyOS/Terminology.yml b/ci/vale/VyOS/Terminology.yml deleted file mode 100644 index cd0c5089..00000000 --- a/ci/vale/VyOS/Terminology.yml +++ /dev/null @@ -1,9 +0,0 @@ -extends: substitution -message: Prefer '%s' over '%s' -ignorecase: false -level: error -swap: - vyos: VyOS - Vyos: VyOS - VYOS: VyOS - Gre: GRE
\ No newline at end of file diff --git a/ci/vyos-linter.py b/ci/vyos-linter.py deleted file mode 100644 index 3bf65484..00000000 --- a/ci/vyos-linter.py +++ /dev/null @@ -1,117 +0,0 @@ -import os -import re -import ipaddress - -IPV4SEG = r'(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])' -IPV4ADDR = r'(?:(?:' + IPV4SEG + r'\.){3,3}' + IPV4SEG + r')' -IPV6SEG = r'(?:(?:[0-9a-fA-F]){1,4})' -IPV6GROUPS = ( - r'(?:' + IPV6SEG + r':){7,7}' + IPV6SEG, # 1:2:3:4:5:6:7:8 - r'(?:\s' + IPV6SEG + r':){1,7}:', # 1:: 1:2:3:4:5:6:7:: - r'(?:' + IPV6SEG + r':){1,6}:' + IPV6SEG, # 1::8 1:2:3:4:5:6::8 1:2:3:4:5:6::8 - r'(?:' + IPV6SEG + r':){1,5}(?::' + IPV6SEG + r'){1,2}', # 1::7:8 1:2:3:4:5::7:8 1:2:3:4:5::8 - r'(?:' + IPV6SEG + r':){1,4}(?::' + IPV6SEG + r'){1,3}', # 1::6:7:8 1:2:3:4::6:7:8 1:2:3:4::8 - r'(?:' + IPV6SEG + r':){1,3}(?::' + IPV6SEG + r'){1,4}', # 1::5:6:7:8 1:2:3::5:6:7:8 1:2:3::8 - r'(?:' + IPV6SEG + r':){1,2}(?::' + IPV6SEG + r'){1,5}', # 1::4:5:6:7:8 1:2::4:5:6:7:8 1:2::8 - IPV6SEG + r':(?:(?::' + IPV6SEG + r'){1,6})', # 1::3:4:5:6:7:8 1::3:4:5:6:7:8 1::8 - r':(?:(?::' + IPV6SEG + r'){1,7}|:)', # ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 :: - r'fe80:(?::' + IPV6SEG + r'){0,4}%[0-9a-zA-Z]{1,}', # fe80::7:8%eth0 fe80::7:8%1 (link-local IPv6 addresses with zone index) - r'::(?:ffff(?::0{1,4}){0,1}:){0,1}[^\s:]' + IPV4ADDR, # ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses) - r'(?:' + IPV6SEG + r':){1,4}:[^\s:]' + IPV4ADDR, # 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33 (IPv4-Embedded IPv6 Address) -) -IPV6ADDR = '|'.join(['(?:{})'.format(g) for g in IPV6GROUPS[::-1]]) # Reverse rows for greedy match - -MAC = r'([0-9A-F]{2}[:-]){5}([0-9A-F]{2})' - -NUMBER = r"([\s']\d+[\s'])" - - -def lint_mac(cnt, line): - mac = re.search(MAC, line, re.I) - if mac is not None: - mac = mac.group() - u_mac = re.search(r'((00)[:-](53)([:-][0-9A-F]{2}){4})', mac, re.I) - m_mac = re.search(r'((90)[:-](10)([:-][0-9A-F]{2}){4})', mac, re.I) - if u_mac is None and m_mac is None: - return f"MAC-Address Error Line {cnt}: {mac}" - - -def lint_ipv4(cnt, line): - ip = re.search(IPV4ADDR, line, re.I) - if ip is not None: - ip = ipaddress.ip_address(ip.group().strip(' ')) - # https://docs.python.org/3/library/ipaddress.html#ipaddress.IPv4Address.is_private - if ip.is_private is False and ip.is_multicast is False: - return f"IPv4 Error Line {cnt}: {ip}" - - -def lint_ipv6(cnt, line): - ip = re.search(IPV6ADDR, line, re.I) - if ip is not None: - ip = ipaddress.ip_address(ip.group().strip(' ')) - # https://docs.python.org/3/library/ipaddress.html#ipaddress.IPv4Address.is_private - if ip.is_private is False and ip.is_multicast is False: - return f"IPv6 Error Line {cnt}: {ip}" - - -def lint_AS(cnt, line): - number = re.search(NUMBER, line, re.I) - if number: - pass - # find a way to detect AS numbers - - -def lint_linelen(cnt, line): - if len(line) > 80: - return f"Line {cnt} too long: len={len(line)}" - - -def handle_file(path, file): - errors = [] - path = '/'.join(path) - filepath = f"{path}/{file}" - try: - with open(filepath) as fp: - line = fp.readline() - cnt = 1 - while line: - err_mac = lint_mac(cnt, line.strip()) - err_ip4 = lint_ipv4(cnt, line.strip()) - err_ip6 = lint_ipv6(cnt, line.strip()) - err_len = lint_linelen(cnt, line.strip()) - if err_mac: - errors.append(err_mac) - if err_ip4: - errors.append(err_ip4) - if err_ip6: - errors.append(err_ip6) - if err_len: - errors.append(err_len) - line = fp.readline() - cnt += 1 - finally: - fp.close() - - if len(errors) > 0: - print(f"File: {filepath}") - for error in errors: - print(error) - print('') - return False - - -def main(): - bool_error = True - # TODO: path and/or files via cli arg - for root, dirs, files in os.walk("../docs"): - path = root.split(os.sep) - for file in files: - if file[-4:] == ".rst": - if handle_file(path, file) is False: - bool_error = False - return bool_error - - -if __name__ == "__main__": - if main() is False: - exit(1) |