Skip to content

Commit

Permalink
Add instructions for flake8 pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobGM committed May 5, 2018
1 parent 11a50fe commit ac7dca5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,12 @@ We use the python source code checker `flake8 <http://flake8.pycqa.org/en/latest
You can lint your code locally by running ``flake8 .`` from the root of the repository.
Integrating ``flake8`` into your workflow is recommended, there are plugins available for most popular `IDEs <https://foxmask.trigger-happy.eu/post/2016/02/17/pycharm-running-flake8/>`_ and `text-editors <https://github.com/nvie/vim-flake8>`_!

You can instruct git to ensure flake8 compliance before every commit by running ``git config --bool flake8.strict true`` from your shell.

In addition to this, some additional styling conventions are applied to the project:

* String literals should use single quotes. With other words: ``'this is a string'`` instead of ``"this is a string"``.
* Always use keyword arguments when invoking functions.
* Try to use keyword arguments when calling functions, unless it is extremely clear from context.
* Function arguments split over several lines should use trailing commas. With other words, we prefer to write code like this:

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

def pytest_addoption(parser):
"""Add command line flags to pytest."""
parser.addoption('--runslow", action="store_true',
parser.addoption('--runslow', action='store_true',
default=False, help='run slow tests')


Expand Down

0 comments on commit ac7dca5

Please sign in to comment.