-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Describe running lint and spellcheck locally in README/Contributing guide #2338
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
Changes from all commits
6dfa2b3
945b213
efb7b46
250f98e
b88d052
9ddc9a8
6ec177e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,3 +51,88 @@ All interactions for this project are covered by the | |
`PSF Code of Conduct <https://www.python.org/psf/codeofconduct/>`_. Everyone is | ||
expected to be open, considerate, and respectful of others no matter their | ||
position within the project. | ||
|
||
|
||
Run pre-commit linting locally | ||
------------------------------ | ||
|
||
You can run this repo's basic linting suite locally, | ||
either on-demand, or automatically against modified files | ||
whenever you commit your changes. | ||
|
||
They are also run in CI, so you don't have to run them locally, though doing | ||
so will help you catch and potentially fix common mistakes before pushing | ||
your changes and opening a pull request. | ||
|
||
This repository uses the `pre-commit <https://pre-commit.com/>`_ tool to | ||
install, configure and update a suite of hooks that check for | ||
common problems and issues, and fix many of them automatically. | ||
|
||
If your system has ``make`` installed, you can run the pre-commit checkers | ||
on the full repo by running ``make lint``. This will | ||
install pre-commit in the current virtual environment if it isn't already, | ||
so make sure you've activated the environment you want it to use | ||
before running this command. | ||
|
||
Otherwise, you can install pre-commit with | ||
|
||
.. code-block:: console | ||
|
||
python -m pip install pre-commit | ||
|
||
(or your choice of installer), and then run the hooks on all the files | ||
in the repo with | ||
|
||
.. code-block:: console | ||
|
||
pre-commit run --all-files | ||
|
||
or only on any files that have been modified but not yet committed with | ||
|
||
.. code-block:: console | ||
|
||
pre-commit run | ||
|
||
If you would like pre-commit to run automatically against any modified files | ||
every time you commit, install the hooks with | ||
|
||
.. code-block:: console | ||
|
||
pre-commit install | ||
|
||
Then, whenever you ``git commit``, pre-commit will run and report any issues | ||
it finds or changes it makes, and abort the commit to allow you to check, | ||
and if necessary correct them before committing again. | ||
|
||
|
||
Check and fix PEP spelling | ||
-------------------------- | ||
|
||
To check for common spelling mistakes in your PEP and automatically suggest | ||
corrections, you can run the codespell tool through pre-commit as well. | ||
|
||
Like the linters, on a system with ``make`` available, it can be installed | ||
(in the currently-activated environment) and run on all files in the | ||
repository with a single command, ``make spellcheck``. | ||
|
||
For finer control or on other systems, after installing pre-commit as in | ||
the previous section, you can run it against only the files | ||
you've modified and not yet committed with | ||
|
||
.. code-block:: console | ||
|
||
pre-commit run --hook-stage manual codespell | ||
|
||
or against all files with | ||
|
||
.. code-block:: console | ||
|
||
pre-commit run --all-files --hook-stage manual codespell | ||
|
||
**Note**: While fixing spelling mistakes as part of more substantive | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps even make this a subheading so we can easily link to it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I guess we could, but after playing around with it I'm not sure it fits well as a full section, nor what a good title for it would be. We can just link the PEP spelling heading, no? Its not like such PRs have been that frequent here... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, that'll be fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, after some discussion on #2350 , I think it would be a good idea to make this a top-level section to discuss what our general policy for changing older PEPs, what contributions are helpful, and which are likely to be declined, I'll modify it accordingly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Err, further revision—after I started drafting text for this section, given this is a broader policy than what was originally envisioned here and might require additional discussion, I think it would be best to keep this PR in scope and add this in an immediate follow-up. I also drafted some other updates for other out of date parts of the contributing guide and readme which can also be handled separately (in this case independently, since they don't conflict with either of these changes). |
||
copyediting and proofreading of draft and active PEPs is okay, | ||
we generally advise against PRs that simply mass-correct minor typos on | ||
older PEPs that don't significantly impair meaning and understanding, | ||
as these tend to create a fairly high level of noise and churn for | ||
PEP readers, authors and editors relative to the amount of practical value | ||
they provide. |
Uh oh!
There was an error while loading. Please reload this page.