Skip to content

Commit 6cc69a8

Browse files
authored
Merge pull request #470 from keploy/feat-add-vale-linting
Add vale linting in github pipeline
2 parents 3b2b83b + 7f03a5d commit 6cc69a8

40 files changed

+858
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Check Docusaurus docs with Vale linter
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
vale:
7+
name: Vale doc linter
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/[email protected]
11+
12+
# Set up Vale Action
13+
- uses: errata-ai/[email protected]
14+
with:
15+
# Filter mode can be set to: added, diff_context, file, nofilter
16+
filter_mode: nofilter
17+
# Set the reporter to display the output: github-pr-check, github-pr-review, github-check
18+
reporter: github-pr-check
19+
# Fails the action if there are errors
20+
fail_on_error: true
21+
# Lint the files in the "versioned_docs/version-2.0.0/" directory
22+
files: 'versioned_docs/version-2.0.0'
23+
# Specify the Vale version
24+
version: 3.0.3
25+
env:
26+
# GitHub token for authentication, automatically set by GitHub Actions
27+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.vale.ini

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# vale.ini
2+
3+
StylesPath = vale_styles # Update this path to where your styles are stored.
4+
MinAlertLevel = error # Set the minimum alert level to display (suggestion, warning, or error).
5+
Vocab = Base
6+
7+
[*.md]
8+
# Enable Markdown-specific styles.
9+
BasedOnStyles = Vale, Google
10+
11+
# Customize specific rules based on your needs.
12+
List.Capitalization = YES
13+
14+
# Override some rules:
15+
Vale.Spelling = YES
16+
Google.PassiveVoice = NO # Disable passive voice rule if unnecessary
17+
Google.We = NO # Disable first-person plural flagging
18+
Google.Will = NO # Allow "will" usage
19+
Google.Exclamation = NO # Allow exclamation points
20+
Google.Ellipses = NO # Allow ellipses in text
21+
Google.Latin = NO # Allow "e.g." and "i.e." instead of "for example"
22+
23+
# Allow specific terms:
24+
Vale.Terms=NO
25+

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,60 @@ npm start
7575

7676
The command starts a local development server and opens a browser window.
7777

78+
## Running Vale Locally for Documentation Linting
79+
80+
To help maintain consistency in our documentation, we use Vale, a syntax-aware linter that checks for spelling, grammar, and style issues.
81+
82+
### Installation
83+
84+
**Step 1: Install Vale**
85+
86+
If you're on macOS, you can install Vale using Homebrew:
87+
88+
```bash
89+
brew install vale
90+
```
91+
92+
Alternatively, you can install Vale manually:
93+
94+
1. Download Vale: Visit the Vale Releases page and download the latest version for your operating system.
95+
96+
2. Install Vale:
97+
98+
- On macOS and Linux, extract the binary, move it to /usr/local/bin, and make it executable:
99+
100+
```bash
101+
sudo mv vale /usr/local/bin/
102+
sudo chmod +x /usr/local/bin/vale
103+
```
104+
105+
- On Windows, follow the instructions in the downloaded .zip file.
106+
107+
**Step 2: Configure Vale**
108+
109+
1. Ensure you have the .vale.ini configuration file in the root directory.
110+
111+
2. Check that StylesPath in .vale.ini points to the vale_styles directory (where custom styles are stored):
112+
113+
```ini
114+
StylesPath = vale_styles
115+
MinAlertLevel = error
116+
```
117+
118+
### Running Vale
119+
120+
1. Linting Documentation: To check all markdown files in versioned_docs/version-2.0.0/ for errors, run:
121+
122+
```bash
123+
vale versioned_docs/version-2.0.0/**/*.md
124+
```
125+
126+
2. Review Errors:
127+
128+
- Vale will output any issues directly in the terminal. Address these issues in the markdown files to maintain style consistency.
129+
130+
Note: Running Vale locally helps catch issues early, ensuring a smooth review process when you submit a pull request.
131+
78132
## Prettier
79133

80134
1. Fork the repository

vale_styles/Google/AMPM.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
extends: existence
2+
message: "Use 'AM' or 'PM' (preceded by a space)."
3+
link: 'https://developers.google.com/style/word-list'
4+
level: error
5+
nonword: true
6+
tokens:
7+
- '\d{1,2}[AP]M'
8+
- '\d{1,2} ?[ap]m'
9+
- '\d{1,2} ?[aApP]\.[mM]\.'

vale_styles/Google/Acronyms.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
extends: conditional
2+
message: "Spell out '%s', if it's unfamiliar to the audience."
3+
link: 'https://developers.google.com/style/abbreviations'
4+
level: suggestion
5+
ignorecase: false
6+
# Ensures that the existence of 'first' implies the existence of 'second'.
7+
first: '\b([A-Z]{3,5})\b'
8+
second: '(?:\b[A-Z][a-z]+ )+\(([A-Z]{3,5})\)'
9+
# ... with the exception of these:
10+
exceptions:
11+
- API
12+
- ASP
13+
- CLI
14+
- CPU
15+
- CSS
16+
- CSV
17+
- DEBUG
18+
- DOM
19+
- DPI
20+
- FAQ
21+
- GCC
22+
- GDB
23+
- GET
24+
- GPU
25+
- GTK
26+
- GUI
27+
- HTML
28+
- HTTP
29+
- HTTPS
30+
- IDE
31+
- JAR
32+
- JSON
33+
- JSX
34+
- LESS
35+
- LLDB
36+
- NET
37+
- NOTE
38+
- NVDA
39+
- OSS
40+
- PATH
41+
- PDF
42+
- PHP
43+
- POST
44+
- RAM
45+
- REPL
46+
- RSA
47+
- SCM
48+
- SCSS
49+
- SDK
50+
- SQL
51+
- SSH
52+
- SSL
53+
- SVG
54+
- TBD
55+
- TCP
56+
- TODO
57+
- URI
58+
- URL
59+
- USB
60+
- UTF
61+
- XML
62+
- XSS
63+
- YAML
64+
- ZIP

vale_styles/Google/Colons.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends: existence
2+
message: "'%s' should be in lowercase."
3+
link: 'https://developers.google.com/style/colons'
4+
nonword: true
5+
level: warning
6+
scope: sentence
7+
tokens:
8+
- ':\s[A-Z]'
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
extends: substitution
2+
message: "Feel free to use '%s' instead of '%s'."
3+
link: 'https://developers.google.com/style/contractions'
4+
level: suggestion
5+
ignorecase: true
6+
action:
7+
name: replace
8+
swap:
9+
are not: aren't
10+
cannot: can't
11+
could not: couldn't
12+
did not: didn't
13+
do not: don't
14+
does not: doesn't
15+
has not: hasn't
16+
have not: haven't
17+
how is: how's
18+
is not: isn't
19+
it is: it's
20+
should not: shouldn't
21+
that is: that's
22+
they are: they're
23+
was not: wasn't
24+
we are: we're
25+
we have: we've
26+
were not: weren't
27+
what is: what's
28+
when is: when's
29+
where is: where's
30+
will not: won't

vale_styles/Google/DateFormat.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
extends: existence
2+
message: "Use 'July 31, 2016' format, not '%s'."
3+
link: 'https://developers.google.com/style/dates-times'
4+
ignorecase: true
5+
level: error
6+
nonword: true
7+
tokens:
8+
- '\d{1,2}(?:\.|/)\d{1,2}(?:\.|/)\d{4}'
9+
- '\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}'

vale_styles/Google/Ellipses.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
extends: existence
2+
message: "In general, don't use an ellipsis."
3+
link: 'https://developers.google.com/style/ellipses'
4+
nonword: true
5+
level: warning
6+
action:
7+
name: remove
8+
tokens:
9+
- '\.\.\.'

vale_styles/Google/EmDash.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
extends: existence
2+
message: "Don't put a space before or after a dash."
3+
link: 'https://developers.google.com/style/dashes'
4+
nonword: true
5+
level: error
6+
action:
7+
name: edit
8+
params:
9+
- remove
10+
- ' '
11+
tokens:
12+
- '\s[—–]\s'

0 commit comments

Comments
 (0)