FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Lint RST on GitHub Actions by hugovk · Pull Request #1802 · python/peps · GitHub

Repository navigation

Lint RST on GitHub Actions - #1802

Merged
gvanrossum merged 4 commits into
python:masterfrom
hugovk:lint-rst-backticks
Feb 8, 2021
Merged

gvanrossum merged 4 commits into
python:masterfrom
hugovk:lint-rst-backticks

Conversation

hugovk commented Feb 7, 2021 •
edited
Loading

Copy link
Copy Markdown
Member

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.

  1. Detect single backticks, which should be double in RST for inline code, e.g. stuff fixed in Fix RST backticks #1554.

  2. 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:

make lint

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.

gvanrossum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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?

hugovk force-pushed the lint-rst-backticks branch from 7ccc045 to 9e1db9d Compare February 8, 2021 11:22

hugovk commented Feb 8, 2021

Copy link
Copy Markdown
Member Author

No, I don't have merge rights. I've rebased and fixed the new issues found PEP 646.

A couple of notes.

Note 1

3d9f45c

This:

(``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, make pep-0646.html gives:

docutils.utils.SystemMessage: pep-0646.rst:284: (ERROR/3) Unknown target name: "type variable tuples with ``union``".

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 2

9e1db9d

@mrahtz:

This 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?

mrahtz commented Feb 8, 2021

Copy link
Copy Markdown
Contributor

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!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL