Merge pull request #3213 from jab/contributing

Add pre-commit to dev dependencies, document it and Black in CONTRIBUTING.
This commit is contained in:
Joshua Bronson 2019-05-23 10:55:06 -04:00 committed by GitHub
commit fe41c6c8ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -37,11 +37,12 @@ Reporting issues
Submitting patches Submitting patches
------------------ ------------------
- Use `Black`_ to autoformat your code. This should be done for you as a
git `pre-commit`_ hook, which gets installed when you run ``pip install -e .[dev]``.
You may also wish to use Black's `Editor integration`_.
- Include tests if your patch is supposed to solve a bug, and explain - Include tests if your patch is supposed to solve a bug, and explain
clearly under which circumstances the bug happens. Make sure the test fails clearly under which circumstances the bug happens. Make sure the test fails
without your patch. without your patch.
- Try to follow `PEP8`_, but you may ignore the line length limit if following
it would make the code uglier.
First time setup First time setup
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
@ -96,8 +97,6 @@ Start coding
git checkout -b your-branch-name origin/master git checkout -b your-branch-name origin/master
- Using your favorite editor, make your changes, `committing as you go`_. - Using your favorite editor, make your changes, `committing as you go`_.
- Try to follow `PEP8`_, but you may ignore the line length limit if following
it would make the code uglier.
- Include tests that cover any code changes you make. Make sure the test fails - Include tests that cover any code changes you make. Make sure the test fails
without your patch. `Run the tests. <contributing-testsuite_>`_. without your patch. `Run the tests. <contributing-testsuite_>`_.
- Push your commits to GitHub and `create a pull request`_ by using:: - Push your commits to GitHub and `create a pull request`_ by using::
@ -107,7 +106,9 @@ Start coding
- Celebrate 🎉 - Celebrate 🎉
.. _committing as you go: https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#commit-your-changes .. _committing as you go: https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#commit-your-changes
.. _PEP8: https://pep8.org/ .. _Black: https://black.readthedocs.io
.. _Editor integration: https://black.readthedocs.io/en/stable/editor_integration.html
.. _pre-commit: https://pre-commit.com
.. _create a pull request: https://help.github.com/articles/creating-a-pull-request/ .. _create a pull request: https://help.github.com/articles/creating-a-pull-request/
.. _contributing-testsuite: .. _contributing-testsuite:

View File

@ -50,6 +50,7 @@ setup(
"sphinx", "sphinx",
"pallets-sphinx-themes", "pallets-sphinx-themes",
"sphinxcontrib-log-cabinet", "sphinxcontrib-log-cabinet",
"pre-commit",
], ],
"docs": ["sphinx", "pallets-sphinx-themes", "sphinxcontrib-log-cabinet"], "docs": ["sphinx", "pallets-sphinx-themes", "sphinxcontrib-log-cabinet"],
}, },