Skip to content
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

Style checking with Vale #227

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d676675
Initial installation of Vale with write-good
timothymcmackin Dec 27, 2023
c09297a
Treat mdx files as md files
timothymcmackin Dec 27, 2023
8da5b54
Initial list of spelling words
timothymcmackin Dec 27, 2023
52dbc62
Run on staging branches
timothymcmackin Dec 27, 2023
7872496
Revert "Run on staging branches"
timothymcmackin Dec 27, 2023
72b0cc5
Run on PRs
timothymcmackin Dec 27, 2023
61fa6f3
try without explicit path to config
timothymcmackin Dec 27, 2023
f9f64e5
spelling
timothymcmackin Dec 27, 2023
6cb18e2
No need to commit the write-good styles
timothymcmackin Dec 27, 2023
ac0f6fe
Enable write-good rules
timothymcmackin Dec 27, 2023
e9b3ef4
Tezos-specific rules
timothymcmackin Dec 27, 2023
ca84187
Capitalization rules
timothymcmackin Dec 27, 2023
5d1f057
Correct ignore to hide downloaded styles but include Tezos styles
timothymcmackin Dec 28, 2023
d5fa453
use just basic Vale and Tezos style rules for now
timothymcmackin Dec 28, 2023
384fded
spelling
timothymcmackin Dec 28, 2023
1f90378
It's ok to capitalize at the beginning of a sentence
timothymcmackin Dec 28, 2023
b2021af
Per Laurent, capitalize JsLIGO and CameLIGO
timothymcmackin Dec 28, 2023
3773728
Style updates that came up after work on style guide
timothymcmackin Dec 29, 2023
f088d32
pr-review seems to work better than pr-check
timothymcmackin Jan 3, 2024
0acc32d
Call this rule Terms
timothymcmackin Jan 4, 2024
d13dfb8
Fix capitalization rule
timothymcmackin Jan 4, 2024
03d8af3
Move tests into existing test workflow
timothymcmackin Jan 9, 2024
6750bf4
Merge branch 'staging' into vale
timothymcmackin Jan 23, 2024
4c5cb1b
More spelling terms
timothymcmackin Jan 23, 2024
d3b764e
Merge branch 'staging' into vale
timothymcmackin Jan 31, 2024
6b9834c
Merge branch 'staging' into vale
timothymcmackin Feb 1, 2024
17e14a0
Move to folder for Vale 3.0
timothymcmackin Feb 1, 2024
ee298a7
Spelling
timothymcmackin Feb 1, 2024
300a6a4
Capitalize Data Availability Layer
timothymcmackin Feb 5, 2024
e5e813a
Merge branch 'staging' into vale
timothymcmackin Feb 6, 2024
4bd5844
Still trying to get the capitalization right
timothymcmackin Feb 6, 2024
56a9d83
this works in vale studio
timothymcmackin Feb 7, 2024
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
5 changes: 5 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:
with:
node-version: 18
- run: npm ci
- uses: errata-ai/vale-action@reviewdog
with:
files: docs
reporter: github-pr-review
filter_mode: added
- run: npm run test -- --reporter JSON --reporter-option output=mocha.json --filesToCheck=${{ needs.checkChangedFiles.outputs.files }}
continue-on-error: true
- uses: dorny/test-reporter@v1
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ node_modules
out
build

# Vale
test/styles/*
!test/styles/Vocab/
!test/styles/Tezos/

test/styles/Vocab/*
!test/styles/Vocab/Tezos
14 changes: 14 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# https://vale.sh/docs/topics/config/

StylesPath = test/styles

MinAlertLevel = suggestion

Vocab = Tezos

# Treat mdx files as md files
[formats]
mdx = md

[*.{md,mdx}]
BasedOnStyles = Vale, Tezos
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ Finally, open [http://localhost:3000](http://localhost:3000) in your browser to
## Tests

The workflow `.github/workflows/tests.yml` runs automated tests on pull requests.
To run tests locally, run `npm run test -- --filesToCheck=docs/developing.md,docs/architecture.mdx`, where `--filesToCheck` is a comma-separated list of the MD and MDX files to test.
It includes these tests:

- Mocha tests that check for broken links to images.
To run these tests locally, run `npm run test -- --filesToCheck=docs/developing.md,docs/architecture.mdx`, where `--filesToCheck` is a comma-separated list of the MD and MDX files to test.

- Vale tests for style, spelling, and capitalization.
To run these tests locally, install [Vale](https://vale.sh/) and run `npm run vale`.

Docusaurus automatically checks for broken links and markdown-encoded images when you run `npm run build`.

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"vale": "vale sync && vale docs/",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"test": "mocha"
Expand Down
7 changes: 7 additions & 0 deletions test/styles/Tezos/Capitalize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends: substitution
message: "Always capitalize '%s'"
level: error
ignorecase: true
swap:
smart rollup: Smart Rollup
smart rollups: Smart Rollups
8 changes: 8 additions & 0 deletions test/styles/Tezos/DoNotCapitalize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends: existence
message: "'%s' should only be capitalized when starting a sentence."
level: error
nonword: true
vocab: false
scope: sentence
tokens:
- (?<=\s)Smart [Cc]contract
8 changes: 8 additions & 0 deletions test/styles/Tezos/Substitutions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends: substitution
message: Use '%s' instead of '%s'
level: warning
ignorecase: true
# swap maps tokens in form of bad: good
swap:
l1: layer 1
l2: layer 2
12 changes: 12 additions & 0 deletions test/styles/Tezos/Terms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extends: existence
message: "Do not use the term '%s'"
level: error
ignorecase: true
tokens:
- 'official Tezos'
- 'official tezos'
- 'ICO'
- 'investors?'
- 'initial coin offering'
- 'chapter'
- 'article'
72 changes: 72 additions & 0 deletions test/styles/config/vocabularies/Tezos/accept.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
Airgap
API
big_map
bitwise
[Bb]lockchains?
Breitman
broadcasted
CameLIGO
Carthagenet
Completium
cooldown
coroutine
[Cc]ryptocurrency
[Cc]ryptocurrencies
Dailynet
dApps?
Data Availability Layer
Deku
delegators?
deserialized?
destructured?
Emilion
Ethereum
Etherlink
Explorus
Flextesa
Ghostnet
Grafana
Grafazos
JsLIGO
keypair
Kukai
LIGO
Mainnet
Merkle
middleware
multisig
Mumbainet
namespace
NFT
Objkt
OCaml
[Oo]ff-chain
[Oo]n-chain
Oxhead
Oxhead Alpha
Que Pasa
Rollups?
Sapling
scriptable
SDKs?
SmartPy
stablecoins?
substring
supermajority
syntax(es)?
Taqueria
Taquito
[Tt]estnet
tez
Tezos
trustlessness
[Tt]zStats
Umami
Unicode
upvotes
URIs?
[Vv]alidators?
Vite
VSCode
Vue
Weeklynet
1 change: 1 addition & 0 deletions test/styles/config/vocabularies/Tezos/reject.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
crypto
Loading