Skip to content

Commit

Permalink
[Docs] implement vale spellchecker (#868)
Browse files Browse the repository at this point in the history
* implement vale spellchecker

add config files for vale, update github action for spellcheck and fix some spelling mistakes
  • Loading branch information
nhennigan authored Dec 5, 2024
1 parent 45db693 commit 9825240
Show file tree
Hide file tree
Showing 11 changed files with 438 additions and 60 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/docs-spelling-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Documentation Spelling Check

on:
workflow_dispatch:
# pull_request:
# paths:
# - 'docs/**'
pull_request:
paths:
- 'docs/**'
permissions:
contents: read

Expand All @@ -13,20 +13,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install aspell
run: sudo apt-get install aspell aspell-en
- name: Install vale
run: sudo snap install vale
- id: spell-check
name: Spell Check
run: make spelling
run: vale --glob='*.{md,txt,rst}' .
working-directory: docs/canonicalk8s
continue-on-error: true
# continue-on-error: true
# - if: ${{ github.event_name == 'pull_request' && steps.spell-check.outcome == 'failure' }}
# uses: actions/github-script@v6
# with:
# script: |
# github.rest.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: 'Hi, looks like pyspelling job found some issues, you can check it [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})'
# })
# uses: actions/github-script@v6
# with:
# script: |
# github.rest.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: 'Hi, looks like the vale spelling job found some issues, you can check it [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})'
# })
8 changes: 8 additions & 0 deletions docs/canonicalk8s/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
StylesPath = styles
MinAlertLevel = warning
Vocab = Canonical
IgnoredScopes =

[*.{md,rst,html}]

Vale.Spelling = YES
4 changes: 2 additions & 2 deletions docs/canonicalk8s/Makefile.sp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ sp-vale: sp-install
@. $(VENV); test -f $(SPHINXDIR)/vale.ini || python3 $(SPHINXDIR)/get_vale_conf.py
@. $(VENV); find $(SPHINXDIR)/venv/lib/python*/site-packages/vale/vale_bin -size 195c -exec vale --config "$(SPHINXDIR)/vale.ini" $(TARGET) > /dev/null \;
@cat $(SPHINXDIR)/styles/config/vocabularies/Canonical/accept.txt > $(SPHINXDIR)/styles/config/vocabularies/Canonical/accept_backup.txt
@cat $(SOURCEDIR)/.wordlist.txt $(SOURCEDIR)/.custom_wordlist.txt >> $(SPHINXDIR)/styles/config/vocabularies/Canonical/accept.txt
@cat ./src/.wordlist.txt ./src/.custom_wordlist.txt >> $(SPHINXDIR)/styles/config/vocabularies/Canonical/accept.txt
@echo ""
@echo "Running Vale against $(TARGET). To change target set TARGET= with make command"
@echo ""
Expand Down Expand Up @@ -148,7 +148,7 @@ sp-allmetrics: sp-html
@. $(VENV); find $(SPHINXDIR)/venv/lib/python*/site-packages/vale/vale_bin -size 195c -exec vale --config "$(SPHINXDIR)/vale.ini" $(TARGET) > /dev/null \;
@eval '$(METRICSDIR)/scripts/source_metrics.sh $(PWD)'
@eval '$(METRICSDIR)/scripts/build_metrics.sh $(PWD) $(METRICSDIR)'


# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
Expand Down
Loading

0 comments on commit 9825240

Please sign in to comment.