Skip to content

Commit

Permalink
Implement vale as pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
maxschulz-COL committed Mar 26, 2024
1 parent dd8b0a5 commit dad843c
Show file tree
Hide file tree
Showing 75 changed files with 99 additions and 1,196 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ repos:
- [email protected]
args: ["--fix"]

- repo: https://github.com/errata-ai/vale
rev: 16d3a7f
hooks:
- id: vale
args: [--config=.vale/.vale.ini]

# Configuration for https://pre-commit.ci/.
ci:
autoupdate_schedule: monthly
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ action:
name: edit
params:
- remove
- ' '
- " "
tokens:
- '[—–]\s|\s[—–]'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 44 additions & 0 deletions .vale/styles/Microsoft/GenderBias.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
extends: substitution
message: "Consider using '%s' instead of '%s'."
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)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ action:
name: edit
params:
- remove
- '.!'
- ".!"
tokens:
- '[a-z][.!](?:\s|$)'
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ level: suggestion
scope: heading
match: $sentence
indicators:
- ':'
- ":"
exceptions:
- Kedro
- Kedro-Viz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ action:
name: edit
params:
- replace
- '-'
- ' '
- "-"
- " "
tokens:
- '\s[^\s-]+ly-'
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ action:
name: edit
params:
- replace
- '-'
- ''
- "-"
- ""
tokens:
- '\s-\d+\s'
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ action:
name: edit
params:
- replace
- '[-–]'
- 'to'
- "[-–]"
- "to"
tokens:
- '\b(?:AM|PM)\s?[-–]\s?.+(?:AM|PM)\b'
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ nonword: true
scope: sentence
level: suggestion
tokens:
- ';'
- ";"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ link: https://docs.microsoft.com/en-us/style-guide/punctuation/periods
level: error
nonword: true
tokens:
- '[a-z][.?!] {2,}[A-Z]'
- "[a-z][.?!] {2,}[A-Z]"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ ignorecase: true
action:
name: replace
swap:
'(?:agent|virtual assistant|intelligent personal assistant)': personal digital assistant
'(?:drive C:|drive C>|C: drive)': drive C
'(?:internet bot|web robot)s?': bot(s)
'(?:microsoft cloud|the cloud)': cloud
'(?:mobile|smart) ?phone': phone
'24/7': every day
'audio(?:-| )book': audiobook
'back(?:-| )light': backlight
'chat ?bots?': chatbot(s)
"(?:agent|virtual assistant|intelligent personal assistant)": personal digital assistant
"(?:drive C:|drive C>|C: drive)": drive C
"(?:internet bot|web robot)s?": bot(s)
"(?:microsoft cloud|the cloud)": cloud
"(?:mobile|smart) ?phone": phone
"24/7": every day
"audio(?:-| )book": audiobook
"back(?:-| )light": backlight
"chat ?bots?": chatbot(s)
adaptor: adapter
administrate: administer
afterwards: afterward
Expand All @@ -29,7 +29,7 @@ swap:
anti-virus: antivirus
appendixes: appendices
artificial intelligence: AI
'(?:assembler|machine language)': assembly language
"(?:assembler|machine language)": assembly language
caap: CaaP
conversation-as-a-platform: conversation as a platform
eb: EB
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ level: error
raw:
- '[a-zA-Z]+\s'
tokens:
- '(?:centi|milli)?meters'
- '(?:kilo)?grams'
- '(?:kilo)?meters'
- '(?:mega)?pixels'
- "(?:centi|milli)?meters"
- "(?:kilo)?grams"
- "(?:kilo)?meters"
- "(?:mega)?pixels"
- cm
- inches
- lb
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extends: existence
message: "Don't use '%s'!"
link: 'https://docs.microsoft.com/en-us/style-guide'
link: "https://docs.microsoft.com/en-us/style-guide"
level: error
ignorecase: true
tokens:
Expand Down
File renamed without changes.
23 changes: 23 additions & 0 deletions .vale/styles/Microsoft/links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
extends: substitution
message: "Avoid vague text in links like '%s' unless you can pair it with more descriptive text."
ignorecase: true
scope: raw
nonword: true
level: error

swap:
# For the word 'here' in Markdown and HTML links
'\[here\]\(.*?\)': "here"
'<a\s*href\s*=\s*".*?".*?>\s*here\s*</a>': "here"

# For the word 'this' in Markdown and HTML links
'\[this\]\(.*?\)': "this"
'<a\s*href\s*=\s*".*?".*?>\s*this\s*</a>': "this"

# For the word 'page' in Markdown and HTML links
'\[page\]\(.*?\)': "page"
'<a\s*href\s*=\s*".*?".*?>\s*page\s*</a>': "page"

# For the phrase 'this page' in Markdown and HTML links
'\[this page\]\(.*?\)': "this page"
'<a\s*href\s*=\s*".*?".*?>\s*this page\s*</a>': "this page"
File renamed without changes.
44 changes: 0 additions & 44 deletions vizro-ai/docs/.vale/styles/Microsoft/GenderBias.yml

This file was deleted.

13 changes: 0 additions & 13 deletions vizro-ai/docs/.vale/styles/Microsoft/HeadingPunctuation.yml

This file was deleted.

77 changes: 0 additions & 77 deletions vizro-ai/docs/.vale/styles/Microsoft/Headings.yml

This file was deleted.

13 changes: 0 additions & 13 deletions vizro-ai/docs/.vale/styles/Microsoft/Negative.yml

This file was deleted.

13 changes: 0 additions & 13 deletions vizro-ai/docs/.vale/styles/Microsoft/RangeTime.yml

This file was deleted.

23 changes: 0 additions & 23 deletions vizro-ai/docs/.vale/styles/Microsoft/links.yml

This file was deleted.

Loading

0 comments on commit dad843c

Please sign in to comment.