Skip to content

Commit 0bd0031

Browse files
authored
Add Vale – preliminary styles and github action (#1235)
1 parent 3566589 commit 0bd0031

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1336
-7
lines changed

.github/workflows/vale.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Vale style check
2+
on:
3+
pull_request:
4+
paths:
5+
- '**.mdx'
6+
- '**.md'
7+
- '.vale/**'
8+
- '.vale.ini'
9+
10+
jobs:
11+
vale:
12+
runs-on: ubuntu-latest
13+
if: |
14+
github.event.pull_request.user.login != 'fern-support' &&
15+
github.event.pull_request.user.login != 'github-actions'
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: errata-ai/vale-action@reviewdog
20+
with:
21+
files: fern
22+
env:
23+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: vale
5+
name: vale
6+
entry: bash -c 'vale --config=.vale.ini "$@"; exit 0' --
7+
language: system
8+
files: \.(md|mdx)$
9+
pass_filenames: true
10+
verbose: true

.vale.ini

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
StylesPath = .vale/styles
2+
3+
MinAlertLevel = suggestion
4+
5+
Packages = Microsoft
6+
7+
[formats]
8+
mdx = md
9+
10+
[*.mdx]
11+
BasedOnStyles = Microsoft, FernStyles
12+
13+
# Disable specific rules
14+
Microsoft.GenderBias = NO # Not relevant for technical documentation
15+
Microsoft.Acronyms = NO # Handled in FernStyles
16+
Microsoft.Vocab = NO # Too granular for now
17+
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
extends: conditional
2+
message: "'%s' has no definition."
3+
link: https://docs.microsoft.com/en-us/style-guide/acronyms
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
65+
- MDX # Fern-specific

.vale/styles/FernStyles/Please.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extends: existence
2+
message: "Avoid using '%s' in technical documentation."
3+
level: warning
4+
ignorecase: true
5+
tokens:
6+
- please # Instead of "Please refer to the documentation", say "Refer to the documentation"

.vale/styles/FernStyles/Reject.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends: substitution
2+
message: "Use '%s' instead of '%s'."
3+
level: error
4+
ignorecase: true
5+
swap:
6+
whitelist: allowlist
7+
blacklist: denylist
8+
Visual Editor: Fern Editor

.vale/styles/Microsoft/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://docs.microsoft.com/en-us/style-guide/a-z-word-list-term-collections/term-collections/date-time-terms
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]\.'
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
extends: existence
2+
message: "Don't use language (such as '%s') that defines people by their disability."
3+
link: https://docs.microsoft.com/en-us/style-guide/a-z-word-list-term-collections/term-collections/accessibility-terms
4+
level: suggestion
5+
ignorecase: true
6+
tokens:
7+
- a victim of
8+
- able-bodied
9+
- an epileptic
10+
- birth defect
11+
- crippled
12+
- differently abled
13+
- disabled
14+
- dumb
15+
- handicapped
16+
- handicaps
17+
- healthy person
18+
- hearing-impaired
19+
- lame
20+
- maimed
21+
- mentally handicapped
22+
- missing a limb
23+
- mute
24+
- non-verbal
25+
- normal person
26+
- sight-impaired
27+
- slow learner
28+
- stricken with
29+
- suffers from
30+
- vision-impaired
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
extends: conditional
2+
message: "'%s' has no definition."
3+
link: https://docs.microsoft.com/en-us/style-guide/acronyms
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

0 commit comments

Comments
 (0)