Skip to content

Add Vale to RTD pre-commit #273

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 7 commits into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is used in both core application repos (.org and corporate)

exclude: '^$|settings|scripts|vendor|\.(min\.js|svg)$|static/.*\.js$'
fail_fast: false
repos:
Expand Down Expand Up @@ -64,3 +66,9 @@ repos:
args: [ --fix ]
# Run the formatter.
- id: ruff-format

repos:
- repo: https://github.com/errata-ai/vale
rev: v3.12.0
hooks:
- id: vale
29 changes: 29 additions & 0 deletions vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
StylesPath = docs/vale/
MinAlertLevel = suggestion

[*.rst]

BasedOnStyles = Vale, RTD, proselint, TheEconomist
Vale.Repetition = YES

# TODO: Enable spelling, but it's currently too noisy
Vale.Spelling = NO

# Initially, some proselint styles were included in vale.
# In later vale versions, those were removed, so now we include
# the full proselint set.
# However, we have a fair bit of legacy that violates the styles
# below, so those are disabled to allow us to move forward for now.
proselint.Very = NO
proselint.But = NO
proselint.Typography = NO
TheEconomist.UnnecessaryWords = NO


; Ignores are a bit janky, do this for now..

[CHANGELOG.rst]
BasedOnStyles =

[docs/dev/*.rst]
BasedOnStyles =
9 changes: 9 additions & 0 deletions vale/RTD/sso.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this file in a PR, so we should reflect that here. But note that the filename is incorrect, it needs to be .yml for vale to find it.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extends: substitution
message: Use 'Single sign-on' instead of '%s'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also note the message double substitution is important. Very silly this isn't just a default for the message attr.

Suggested change
message: Use 'Single sign-on' instead of '%s'
message: Use '%s' instead of '%s'

level: warning
swap:
Single Sign-On: Single sign-on
Single Sign on: Single sign-on
single sign-on: Single sign-on
single Sign-On: Single sign-on
single Sign on: Single sign-on
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is substituting a capitalized version still. I fixed this using case insensitivity and exceptions:

readthedocs/readthedocs.org#12260

7 changes: 7 additions & 0 deletions vale/RTD/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: substitution
message: Use '%s' instead of '%s'
level: error
swap:
Read The Docs: Read the Docs
RTD: Read the Docs
ReadTheDocs: Read the Docs
17 changes: 17 additions & 0 deletions vale/TheEconomist/Hectoring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extends: existence
message: "'%s' - Do not be hectoring or arrogant"
description: "Those who disagree with you are not necessarily '%s.'"
link: http://www.economist.com/styleguide/introduction
scope: text
level: warning
ignorecase: true
tokens:
- stupid
- idiotic
- imbecile
- ignorant
- insane
- absurd
- ridiculous
- lunatic
- asinine
34 changes: 34 additions & 0 deletions vale/TheEconomist/UnnecessaryWords.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
extends: existence
message: "'%s' - See section 'Unnecessary words'"
level: warning
scope: text
description: Some words add nothing but length to your prose.
link: http://www.economist.com/style-guide/unnecessary-words
ignorecase: true
tokens:
- any time soon
- bought up
- cut back
- cutbacks
- for free
- free gift
- freed up
- hatched up
- headed up by
- large-scale
- meet with
- Most especially
- Most probably
- policymaking process
- safe haven
- sale events
- sent off to bed
- so-called
- sold off
- strike action
- The fact that
- This time around
- top priority
- track record
- weather conditions
- wilderness area
1 change: 1 addition & 0 deletions vale/TheEconomist/style.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Based on [The Economist](http://www.economist.com/styleguide/introduction).
8 changes: 8 additions & 0 deletions vale/proselint/Airlinese.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends: existence
message: "'%s' is airlinese."
ignorecase: true
level: error
tokens:
- enplan(?:e|ed|ing|ement)
- deplan(?:e|ed|ing|ement)
- taking off momentarily
48 changes: 48 additions & 0 deletions vale/proselint/AnimalLabels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
extends: substitution
message: "Consider using '%s' instead of '%s'."
level: error
action:
name: replace
swap:
(?:bull|ox)-like: taurine
(?:calf|veal)-like: vituline
(?:crow|raven)-like: corvine
(?:leopard|panther)-like: pardine
bird-like: avine
centipede-like: scolopendrine
crab-like: cancrine
crocodile-like: crocodiline
deer-like: damine
eagle-like: aquiline
earthworm-like: lumbricine
falcon-like: falconine
ferine: wild animal-like
fish-like: piscine
fox-like: vulpine
frog-like: ranine
goat-like: hircine
goose-like: anserine
gull-like: laridine
hare-like: leporine
hawk-like: accipitrine
hippopotamus-like: hippopotamine
lizard-like: lacertine
mongoose-like: viverrine
mouse-like: murine
ostrich-like: struthionine
peacock-like: pavonine
porcupine-like: hystricine
rattlesnake-like: crotaline
sable-like: zibeline
sheep-like: ovine
shrew-like: soricine
sparrow-like: passerine
swallow-like: hirundine
swine-like: suilline
tiger-like: tigrine
viper-like: viperine
vulture-like: vulturine
wasp-like: vespine
wolf-like: lupine
woodpecker-like: picine
zebra-like: zebrine
9 changes: 9 additions & 0 deletions vale/proselint/Annotations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extends: existence
message: "'%s' left in text."
ignorecase: false
level: error
tokens:
- XXX
- FIXME
- TODO
- NOTE
8 changes: 8 additions & 0 deletions vale/proselint/Apologizing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends: existence
message: "Excessive apologizing: '%s'"
ignorecase: true
level: error
action:
name: remove
tokens:
- More research is needed
52 changes: 52 additions & 0 deletions vale/proselint/Archaisms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
extends: existence
message: "'%s' is archaic."
ignorecase: true
level: error
tokens:
- alack
- anent
- begat
- belike
- betimes
- boughten
- brocage
- brokage
- camarade
- chiefer
- chiefest
- Christiana
- completely obsolescent
- cozen
- divers
- deflexion
- fain
- forsooth
- foreclose from
- haply
- howbeit
- illumine
- in sooth
- maugre
- meseems
- methinks
- nigh
- peradventure
- perchance
- saith
- shew
- sistren
- spake
- to wit
- verily
- whilom
- withal
- wot
- enclosed please find
- please find enclosed
- enclosed herewith
- enclosed herein
- inforce
- ex postfacto
- foreclose from
- forewent
- for ever
8 changes: 8 additions & 0 deletions vale/proselint/But.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends: existence
message: "Do not start a paragraph with a 'but'."
level: error
scope: paragraph
action:
name: remove
tokens:
- ^But
Loading