-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Lint RST inline code on GitHub Actions #1570
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
Could this be done in the build itself? It looks like single backticks are customizable; can they be customized to raise errors? |
By build, do you mean the Travis CI build? Yes, it could be easily added there. I chose to put it in a separate thing so if there's a problem, it obvious if it's from the build or the lint. For example: But happy to move it to Travis CI if that's preferred. You can also enable GitHub Actions (and Travis CI) for your fork, so you can see failures before submitting a PR. Yes, it's possible to check locally, in a couple of ways. # One off
pip install -U pre-commit
# Lint all the RST files
make lint So you could do stuff like # One off
pip install -U pre-commit
pre-commit install
# Commit stuff as normal, it'll run the lint (if RST changed)
# and fail the commit if there's a problem
git commit -m "PEP XXX: etc"
Nice idea, I'm not familiar enough with RST for this. |
We can also move the build to GitHub Actions; Travis is not special in this case. |
I've added a GitHub Actions workflow to the build and deploy, like Travis CI. Notes:
|
Would it help if I split this PR? |
@hugovk you mean split the Travis -> GHA work from the linting part? Yeah, it would probably help since that removes the worry of whether the linting is what we want from whether we want to move off of Travis. |
) | ||
|
||
run: | | ||
bash deploy.bash |
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.
Is this actually triggering a deployment?
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.
Yes, but only for the python/peps
repo and master
branch (like .travis.yml
).
As a demo, here's another branch that allows a deploy for my fork and that branch:
The deploy is triggered (and fails, as expected due to lack of credentials in my repo):
Replaced by separate PRs:
|
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.
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.
The first lint rule finds some false positives:
pep-0012.rst is an example of what not to do! So that needs to stay.
pep-0505.rst is example output from a command, so (most likely) needs to stay.
The other three are from comments in code. Because it's (indented) code, no extra formatting is added in the rendered monospace output. so these could be changed to either double backticks or no backticks from a formatting point of view.
Now, there's no way to exclude single lines from the linter, so the whole file needs to be excluded.
Question
Should the single backticks be changed in the latter three code comments?