Skip to content

Add vale linter bot #7126

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
env: TOXENV=eslint NODE_VERSION=10.17.0
- python: 3.6
env: TOXENV=migrations
- python: 3.6
env: TOXENV=vale-lint
before_install: curl -sfL https://install.goreleaser.com/github.com/ValeLint/vale.sh | sh -s v2.2.0; export PATH="./bin:$PATH"

allow_failures:
- env: TOXENV=docs-linkcheck
Expand Down
4 changes: 4 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
StylesPath = vale/styles

[*.rst]
BasedOnStyles = RTD
8 changes: 7 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
minversion=2.9.0
envlist = py36,lint,docs
envlist = py36,lint,docs,vale-lint
skipsdist = True

[travis]
Expand Down Expand Up @@ -46,6 +46,12 @@ changedir = {toxinidir}
commands =
./manage.py makemigrations --check --dry-run

[testenv:vale-lint]
description = Check for incorrect usage of Read the Docs in the docs
whitelist_externals = vale
commands =
vale {toxinidir}/docs

[testenv:docs-lint]
description = run linter (rstcheck) to ensure there aren't errors on our docs
deps = -r{toxinidir}/requirements/docs-lint.txt
Expand Down
6 changes: 6 additions & 0 deletions vale/styles/RTD/Branding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extends: substitution
message: Use '%s' instead of '%s'
level: error
swap:
Read The Docs: Read the Docs
RTD: Read the Docs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to enable this usage in some places, but the above rule makes sense to me.

Copy link
Contributor Author

@santos22 santos22 Jun 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we can disable and enable with the following markup comments:

Read The Docs

.. vale off

Read The Docs

.. vale on

Read The Docs

So in that example, an error would be thrown for text before .. vale off and for text after .. vale on.

Source: https://errata-ai.gitbook.io/vale/getting-started/markup#restructuredtext