Skip to content

Commit 2a53448

Browse files
committed
Add Vale linting for our docs
- I noticed that another open source project had taken the Homebrew style guide and made it into [Vale linting rules](https://github.com/testthedocs/vale-styles/tree/master/Homebrew). This copies them into here, so that we can make use of them. Thanks! - What use is a style guide if our own docs don't at least try to adhere to it? This aims to make the rules more visible to all contributors. - In order for these to do anything, you'll have to `brew install vale` and run `vale` in the root of this repo. It will look for Markdown files. - A next step would be adding this as a pre-commit hook, or... - The GitHub Action would have been really good, but [it doesn't support forks](https://github.com/errata-ai/vale-action#limitations).
1 parent 205a086 commit 2a53448

File tree

9 files changed

+73
-0
lines changed

9 files changed

+73
-0
lines changed

docs/_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ exclude:
77
- bin
88
- CNAME
99
- Gemfile*
10+
- vale-styles
1011
- vendor
1112

1213
plugins:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
extends: substitution
3+
message: Use '%s'
4+
ignorecase: false
5+
link: 'https://github.com/Homebrew/brew/blob/master/docs/Prose-Style-Guidelines.md#style-and-usage'
6+
level: error
7+
nonword: true
8+
swap:
9+
'\beg\b': e.g.
10+
'\bie\b': i.e.
11+
'e\.g\.,': e.g.
12+
'i\.e\.,': i.e.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
extends: existence
3+
message: 'No Oxford commas!'
4+
link: 'https://github.com/Homebrew/brew/blob/master/docs/Prose-Style-Guidelines.md#typographical-conventions'
5+
scope: sentence
6+
level: warning
7+
tokens:
8+
- '(?:[^,]+,){1,}\s\w+,\sand'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
extends: existence
3+
message: Avoid gender-specific language when not necessary.
4+
link: 'https://github.com/Homebrew/brew/blob/master/docs/Prose-Style-Guidelines.md#personal-pronouns'
5+
level: warning
6+
ignorecase: true
7+
tokens:
8+
- him
9+
- her
10+
- she
11+
- he
12+
- his
13+
- hers
14+
- himself
15+
- herself

docs/vale-styles/Homebrew/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Based on Homebrew's [Prose Style Guidelines](http://docs.brew.sh/Prose-Style-Guidelines.html).

docs/vale-styles/Homebrew/Spacing.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
extends: existence
3+
message: "'%s' should have one space."
4+
link: 'https://github.com/Homebrew/brew/blob/master/docs/Prose-Style-Guidelines.md#typographical-conventions'
5+
level: error
6+
nonword: true
7+
tokens:
8+
- '[a-z][.?!][A-Z]'
9+
- '[.?!] {2,}[A-Z]'

docs/vale-styles/Homebrew/Terms.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
extends: substitution
3+
message: Use '%s' instead of '%s'.
4+
link: 'https://github.com/Homebrew/brew/blob/master/docs/Prose-Style-Guidelines.md#terminology-words-and-word-styling'
5+
level: error
6+
swap:
7+
Pull Request: pull request
8+
repo: repository
9+
Rubocop: RuboCop

docs/vale-styles/Homebrew/Titles.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
extends: capitalization
3+
message: "'%s' should be in sentence case"
4+
level: warning
5+
scope: heading
6+
match: $sentence
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
extends: existence
3+
message: 'No "TM", ™, SM, ©, ®, or other explicit indicators of rights ownership or trademarks'
4+
link: 'https://github.com/Homebrew/brew/blob/master/docs/Prose-Style-Guidelines.md#typographical-conventions'
5+
level: error
6+
nonword: true
7+
tokens:
8+
- \bTM\b
9+
-
10+
- \bSM\b
11+
- ©
12+
- ®

0 commit comments

Comments
 (0)