Skip to content

Commit

Permalink
T1731: 1st version to test vale
Browse files Browse the repository at this point in the history
  • Loading branch information
rebortg committed Oct 14, 2019
1 parent 61d3f94 commit f5f5780
Show file tree
Hide file tree
Showing 38 changed files with 711 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .vale
@@ -0,0 +1,34 @@
StylesPath = ci/vale
MinAlertLevel = suggestion

[*.rst]
BasedOnStyles = VyOS

Google.DateFormat = YES
vale.GenderBias = NO
vale.Hedging = NO
vale.Redundancy = NO
vale.Repetition = YES
vale.Uncomparables = NO
proselint.GenderBias = YES

# Custom block scoping (see the regex101 links for unit tests):
#
# Rule #1 (https://regex101.com/r/TJQLJ4/2/tests): Ignore `{%comment%}` blocks. This
# keeps Vale from flagging 'endcomment' as a spelling mistake.
#
# Rule #2 (https://regex101.com/r/7VA2lV/2/tests): Ignore `<div>`s and `<section>`s
# that specify `markdown="1"` since it isn't supported by Vale's Markdown
# parser (https://github.com/russross/blackfriday/issues/184).
#
# Rule #3 (https://regex101.com/r/NxFflU/1/tests): Ignore `{% include %}`-codeblock
# pairs.
BlockIgnores = (?s)({%\s?comment\s?%}.+?{%\s?endcomment\s?%}), \
(?s)(<(?:div|section)[^>]*markdown="1"[^>]*>.*?</(?:div|section)>), \
(?s)((?: *{% include [^%]+ %}\n)? *~~~.*?~~~~?)

# Custom inline scoping (see the regex101 links for unit tests):
#
# Rule #1 (https://regex101.com/r/cTiITH/2/tests): Ignore `{% include %}`s, which
# contain file paths.
TokenIgnores = ({%\s?include\s? {{ [^}]+ }}[^%]+\s?%})
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -58,3 +58,17 @@ docker run --rm -it -v "$(pwd):/vyos" -w /vyos/docs vyos-docu make html
docker run --rm -it -p 8000:8000 -v "$(pwd):/vyos" -w /vyos/docs vyos-docu make livehtml
```

### Test the docs

discuss in this Task: [T1731](https://phabricator.vyos.net/T1731)

to test all files:

```bash
$ docker run --rm -it -v "$(pwd)":/vyos -w /vyos/docs -e GOSU_UID=$(id -u) -e GOSU_GID=$(id -g) vyos-docu vale .
```

to test a specific file e.g. clustering.rst
```bash
$ docker run --rm -it -v "$(pwd)":/vyos -w /vyos/docs -e GOSU_UID=$(id -u) -e GOSU_GID=$(id -g) vyos-docu vale clustering.rst
```
9 changes: 9 additions & 0 deletions ci/vale/Google/AMPM.yml
@@ -0,0 +1,9 @@
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]\.'
64 changes: 64 additions & 0 deletions ci/vale/Google/Acronyms.yml
@@ -0,0 +1,64 @@
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
7 changes: 7 additions & 0 deletions ci/vale/Google/Colons.yml
@@ -0,0 +1,7 @@
extends: existence
message: "'%s' should be in lowercase."
link: 'https://developers.google.com/style/colons'
nonword: true
level: warning
tokens:
- ':\s[A-Z]'
28 changes: 28 additions & 0 deletions ci/vale/Google/Contractions.yml
@@ -0,0 +1,28 @@
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
9 changes: 9 additions & 0 deletions ci/vale/Google/DateFormat.yml
@@ -0,0 +1,9 @@
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}'
7 changes: 7 additions & 0 deletions ci/vale/Google/Ellipses.yml
@@ -0,0 +1,7 @@
extends: existence
message: "In general, don't use an ellipsis."
link: 'https://developers.google.com/style/ellipses'
nonword: true
level: warning
tokens:
- '\.\.\.'
8 changes: 8 additions & 0 deletions ci/vale/Google/EmDash.yml
@@ -0,0 +1,8 @@
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'
7 changes: 7 additions & 0 deletions ci/vale/Google/EnDash.yml
@@ -0,0 +1,7 @@
extends: existence
message: "Use an em dash ('—') instead of '–'."
link: 'https://developers.google.com/style/dashes'
nonword: true
level: error
tokens:
- ''
7 changes: 7 additions & 0 deletions ci/vale/Google/Exclamation.yml
@@ -0,0 +1,7 @@
extends: existence
message: "Don't use exclamation points in text."
link: 'https://developers.google.com/style/exclamation-points'
nonword: true
level: error
tokens:
- '!'
11 changes: 11 additions & 0 deletions ci/vale/Google/FirstPerson.yml
@@ -0,0 +1,11 @@
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
9 changes: 9 additions & 0 deletions ci/vale/Google/Gender.yml
@@ -0,0 +1,9 @@
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
45 changes: 45 additions & 0 deletions ci/vale/Google/GenderBias.yml
@@ -0,0 +1,45 @@
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)
8 changes: 8 additions & 0 deletions ci/vale/Google/HeadingPunctuation.yml
@@ -0,0 +1,8 @@
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|$)'
26 changes: 26 additions & 0 deletions ci/vale/Google/Headings.yml
@@ -0,0 +1,26 @@
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
8 changes: 8 additions & 0 deletions ci/vale/Google/Hyphens.yml
@@ -0,0 +1,8 @@
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'
9 changes: 9 additions & 0 deletions ci/vale/Google/Latin.yml
@@ -0,0 +1,9 @@
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
8 changes: 8 additions & 0 deletions ci/vale/Google/LyHyphens.yml
@@ -0,0 +1,8 @@
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-'
7 changes: 7 additions & 0 deletions ci/vale/Google/OptionalPlurals.yml
@@ -0,0 +1,7 @@
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\)'
7 changes: 7 additions & 0 deletions ci/vale/Google/Ordinal.yml
@@ -0,0 +1,7 @@
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)
7 changes: 7 additions & 0 deletions ci/vale/Google/OxfordComma.yml
@@ -0,0 +1,7 @@
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'
7 changes: 7 additions & 0 deletions ci/vale/Google/Parens.yml
@@ -0,0 +1,7 @@
extends: existence
message: "Use parentheses judiciously."
link: 'https://developers.google.com/style/parentheses'
nonword: true
level: suggestion
tokens:
- '\(.+\)'

0 comments on commit f5f5780

Please sign in to comment.