-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Lint RST on GitHub Actions #1802
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Do you have powers to merge here?
FWIW I think there are a few more PEPs that fail this test, maybe you can re-trigger a run?
7ccc045
to
9e1db9d
Compare
No, I don't have merge rights. I've rebased and fixed the new issues found PEP 646. A couple of notes. Note 1This: (``Union`` is the one exception to this rule; see `Type Variable Tuples with ``Union```.) Should be a link to this header: Type Variable Tuples with ``Union``
----------------------------------- But RST doesn't like code formatting inside links,
See https://stackoverflow.com/q/4743845/724176 for ugly workarounds. So instead I've made the link without code formatting, and the HTML generation and link works. Note 2This looks like it should be a link to a header: Following `Type Variable Tuples Must Have Finite Length When Bound`, note But there's no header with that name. "Type Variable Tuples Must Have Known Length" looks the closest to me. Is that the right one? |
Super nice work! I was always a bit worried about linting when writing PEP 646. Note 2 - yes, that's right, it should be "Type Variable Tuples Must Have Known Length". Thanks! |
New version of #1668, main difference is the linter has been updated so the
rst-backticks
skips code blocks (lines beginning with four spaces).Lint rules
This PR adds two reStructuredText lint rules and runs them on the CI using GitHub Actions. Example run.
Detect single backticks, which should be double in RST for inline code, e.g. stuff fixed in Fix RST backticks #1554.
Detect inline code touching normal text, e.g. stuff fixed in Fix incorrect backticks #1560.
make lint
It adds a standalone
make
command to lint locally:The pre-commit dependency is installed if needed.
Optional git pre-commit hook
This uses the pre-commit tool for linting. It's possible, but completely optional, to use it locally and it'll check your changes when you're committing, and fail before commit if something is found.
Optional local set up (run once):
pip install -U pre-commit && pre-commit install
Then make changes and commit as normal:
git commit -m "PEP XXX: etc"
Lint all files:
pre-commit run --all-files # Or this does the same thing make lint
The very first run takes a little while to set things up, after that it's quick.
But again, local use of pre-commit is completely optional for those who aren't keen, and the CI will run the checks anyway.
And
make lint
can be used completely independently of the git pre-commit hook.