Skip to content

Commit d2383df

Browse files
Update Vale guidelines checker and fix issues (#570)
* updated vale * fix Vale issues * exclude vale style dirs from lint checks Signed-off-by: Nicolas MASSART <[email protected]>
1 parent 6b736d5 commit d2383df

File tree

174 files changed

+4360
-741
lines changed

Some content is hidden

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

174 files changed

+4360
-741
lines changed

.circleci/config.yml

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,29 @@ executors:
1111
docker:
1212
- image: circleci/buildpack-deps:buster-scm
1313

14+
commands:
15+
install_node:
16+
description: "Install Node dependencies"
17+
steps:
18+
- restore_cache:
19+
keys:
20+
- deps-{{ checksum "package-lock.json" }}
21+
- run:
22+
name: update-npm
23+
command: 'sudo npm install -g npm@latest'
24+
- run:
25+
name: Install dependencies
26+
command: |
27+
npm ci
28+
29+
save_node_cache:
30+
description: "Save Node dependencies"
31+
steps:
32+
- save_cache:
33+
paths:
34+
- ./node_modules
35+
key: deps-{{ checksum "package-lock.json" }}
36+
1437
jobs:
1538
dco:
1639
executor: shell_executor
@@ -65,11 +88,11 @@ jobs:
6588
- run:
6689
name: Install dependencies
6790
command: |
68-
curl -sfL https://install.goreleaser.com/github.com/ValeLint/vale.sh | sh -s v1.7.1
91+
curl -sfL https://install.goreleaser.com/github.com/ValeLint/vale.sh | sh -s v2.6.6
6992
- run:
7093
name: Run Vale
7194
command: |
72-
./bin/vale --config ./CI/vale_styles/.vale.ini --glob='*.{md}' . | tee ./vale.out
95+
./bin/vale --config ./CI/vale/.vale.ini --glob='*.{md}' . | tee ./vale.out
7396
- store_artifacts:
7497
path: ./vale.out
7598
destination: ./vale.out
@@ -78,24 +101,12 @@ jobs:
78101
executor: node_executor
79102
steps:
80103
- checkout
81-
- run:
82-
name: update-npm
83-
command: 'sudo npm install -g npm@latest'
84-
- restore_cache:
85-
keys:
86-
- deps-{{ checksum "package-lock.json" }}
87-
- run:
88-
name: Install dependencies
89-
command: |
90-
npm ci
104+
- install_node
91105
- run:
92106
name: Run markdown link checker
93107
command: |
94108
npm run test:links
95-
- save_cache:
96-
paths:
97-
- ./node_modules
98-
key: deps-{{ checksum "package-lock.json" }}
109+
- save_node_cache
99110
- store_artifacts:
100111
path: ./linkchecker.out
101112
destination: linkchecker.out
@@ -104,13 +115,7 @@ jobs:
104115
executor: node_executor
105116
steps:
106117
- checkout
107-
- restore_cache:
108-
keys:
109-
- deps-{{ checksum "package-lock.json" }}
110-
- run:
111-
name: Install dependencies
112-
command: |
113-
npm ci
118+
- install_node
114119
- run:
115120
shell: /bin/bash #this is a non breaking command so it will always return success
116121
name: Run Markdownlint info checks
@@ -120,10 +125,7 @@ jobs:
120125
name: Run Markdownlint
121126
command: |
122127
npm run test:markdown
123-
- save_cache:
124-
paths:
125-
- ./node_modules
126-
key: deps-{{ checksum "package-lock.json" }}
128+
- save_node_cache
127129
- store_artifacts:
128130
path: ./markdownlint.out
129131
destination: ./markdownlint.out

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ see #{your issue number} -->
3737
- [ ] Python dependencies
3838
- [ ] Node dependencies and JavaScript
3939
- [ ] ReadTheDocs configuration
40-
- [ ] Github integration
40+
- [ ] GitHub integration
4141

4242
## Testing
4343

.markdownlintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# these files are copied from the Vale style repositories
2+
CI/vale/vale_styles/*/*.md

CI/scripts/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ work to the GitHub repositories.
1010

1111
## Running the scripts
1212

13-
Go to the besu-doc project root directory and run one of the following scripts:
13+
Go to the `besu-doc` project root directory and run one of the following scripts:
1414

1515
* `CI/scripts/test_build.sh` runs the doc build with MkDocs.
1616
* `CI/scripts/test_guidelines.sh` tests the doc with Vale and our custom rules.
1717
* `CI/scripts/test_links.sh` tests the internal and external links in the doc. If a link is
18-
incorrect or the targeted web page is unavailable (for external sites), the test will fail and
18+
incorrect or the targeted Web page is unavailable (for external sites), the test will fail and
1919
display the faulty link.
2020
* `CI/scripts/test_markdown_syntax.sh` tests the Markdown syntax for issues. Sometimes they are not visible
2121
but making sure the markdown is correct helps to make it readable and bug free.
Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
# Example Vale config file (`.vale.ini` or `_vale.ini`)
1+
# Vale configuration
22

3-
# Core settings
3+
# Styles directory
4+
# See vale_styles/README.md file for details and licencing information
45
StylesPath = vale_styles
56

7+
# Here's were we define the exceptions to use in *all*
8+
# `BasedOnStyles`.
9+
Vocab = Besu
10+
611
# The minimum alert level to display (suggestion, warning, or error).
7-
#
812
# CI builds will only fail on error-level alerts.
9-
MinAlertLevel = warning
13+
MinAlertLevel = error
1014

1115
# The "formats" section allows you to associate an "unknown" format
1216
# with one of Vale's supported formats.
@@ -16,15 +20,12 @@ mdx = md
1620
# Global settings (applied to every syntax)
1721
[*]
1822
# List of styles to load
19-
BasedOnStyles = proselint, write-good, Joblint, Microsoft, Besu
23+
BasedOnStyles = Vale, proselint, write-good, Microsoft, Besu
2024
# Style.Rule = {YES, NO} to enable or disable a specific rule
21-
vale.Editorializing = YES
22-
vale.Redundancy = YES
23-
vale.Repetition = YES
24-
vale.GenderBias = YES
2525

2626
Microsoft.Contractions = NO
2727
Microsoft.GeneralURL = NO
28+
# Microsoft.Acronyms is replaced by Besu list
2829
Microsoft.Acronyms = NO
2930
Microsoft.Quotes = suggestion
3031
Microsoft.We = suggestion
@@ -35,6 +36,10 @@ write-good.Weasel = NO
3536

3637
proselint.Hyperbole = warning
3738

38-
[common/CLA.md]
3939
# Disable guidelines check for this file as it's legal jargon
40+
[CODE_OF_CONDUCT.md]
41+
BasedOnStyles =
42+
43+
[CI/vale/vale_styles/*.md]
44+
# Disable guidelines check for this dir as it contains imported styles
4045
BasedOnStyles =

CI/vale_styles/Besu/Acronyms.yml renamed to CI/vale/vale_styles/Besu/Acronyms.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ second: '(?:\b[A-Z][a-z]+ )+\(([A-Z]{3,5})\)'
88
# ... with the exception of these:
99
exceptions:
1010
- API
11+
- AWS
1112
- CLA
1213
- CLI
1314
- CPU
@@ -25,12 +26,16 @@ exceptions:
2526
- IBFT
2627
- IBFT2
2728
- IDE
29+
- IPC
2830
- JAR
2931
- JDK
3032
- JRE
3133
- JSON
34+
- JVM
35+
- P2P
3236
- PATH
3337
- PIP
38+
- PBFT
3439
- POA
3540
- POS
3641
- POST
@@ -49,7 +54,9 @@ exceptions:
4954
- TOML
5055
- URI
5156
- URL
57+
- VM
58+
- WAR
5259
- WEI
5360
- XML
5461
- YAML
55-
- ZIP
62+
- ZIP
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
extends: capitalization
2+
message: "'%s' should use sentence-style capitalization."
3+
link: 'https://docs.microsoft.com/en-us/style-guide/capitalization'
4+
level: suggestion
5+
scope: heading
6+
match: $sentence
7+
indicators:
8+
- ':'
9+
exceptions:
10+
- Besu
11+
- EthSigner
12+
- GoQuorum
13+
- Quorum
14+
- Orion
15+
- Hyperledger
16+
- PegaSys
17+
- Consensys
18+
- Ethereum
19+
- ETH
20+
- TOML
21+
- YAML
22+
- YML
23+
- JSON
24+
- RPC
25+
- Hashicorp
26+
- Vault
27+
- Azure
28+
- CLI
29+
- Code
30+
- Cosmos
31+
- Docker
32+
- Emmet
33+
- I
34+
- Kubernetes
35+
- Linux
36+
- macOS
37+
- Marketplace
38+
- MongoDB
39+
- REPL
40+
- Studio
41+
- TypeScript
42+
- URLs
43+
- Visual
44+
- VS
45+
- Windows

CI/vale/vale_styles/Besu/Latin.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends: substitution
2+
message: "Prefer English '%s' over Latin '%s' term."
3+
level: error
4+
ignorecase: true
5+
action:
6+
name: replace
7+
swap:
8+
de facto: default
File renamed without changes.

CI/vale_styles/Microsoft/Accessibility.yml renamed to CI/vale/vale_styles/Microsoft/Accessibility.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
extends: existence
2-
message: "Dont use language ('%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/bits-bytes-terms'
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
44
level: suggestion
55
ignorecase: true
66
tokens:

0 commit comments

Comments
 (0)