Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Recommended flake8 to check coding style.

  • Loading branch information...
commit 14c1872d29a662689a316ef9ab1ccdd82d3ca906 1 parent e6dd70b
@timgraham timgraham authored
Showing with 11 additions and 11 deletions.
  1. +11 −11 docs/internals/contributing/writing-code/coding-style.txt
View
22 docs/internals/contributing/writing-code/coding-style.txt
@@ -9,9 +9,12 @@ Python style
* Unless otherwise specified, follow :pep:`8`.
- You could use a tool like `pep8`_ to check for some problems in this
- area, but remember that :pep:`8` is only a guide, so respect the style of
- the surrounding code as a primary goal.
+ Use `flake8`_ to check for problems in this area. Note that our ``setup.cfg``
+ file contains some excluded files (deprecated modules we don't care about
+ cleaning up and some third-party code that Django vendors) as well as some
+ excluded errors that we don't consider as gross violations. Remember that
+ :pep:`8` is only a guide, so respect the style of the surrounding code as a
+ primary goal.
One big exception to :pep:`8` is our preference of longer line lengths.
We're well into the 21st Century, and we have high-resolution computer
@@ -194,16 +197,15 @@ Miscellaneous
documentation </topics/i18n/index>` for details.
* Remove ``import`` statements that are no longer used when you change code.
- The most common tools for this task are `pyflakes`_ and `pylint`_.
+ `flake8`_ will identify these imports for you. If an unused import needs to
+ remain for backwards-compatability, mark the end of of with ``# NOQA`` to
+ silence the flake8 warning.
* Systematically remove all trailing whitespaces from your code as those
add unnecessary bytes, add visual clutter to the patches and can also
occasionally cause unnecessary merge conflicts. Some IDE's can be
configured to automatically remove them and most VCS tools can be set to
- highlight them in diff outputs. Note, however, that patches which only
- remove whitespace (or only make changes for nominal :pep:`8` conformance)
- are likely to be rejected, since they only introduce noise rather than
- code improvement. Tidy up when you're next changing code in the area.
+ highlight them in diff outputs.
* Please don't put your name in the code you contribute. Our policy is to
keep contributors' names in the ``AUTHORS`` file distributed with Django
@@ -211,6 +213,4 @@ Miscellaneous
change to the ``AUTHORS`` file in your patch if you make more than a
single trivial change.
-.. _pep8: http://pypi.python.org/pypi/pep8
-.. _pyflakes: http://pypi.python.org/pypi/pyflakes
-.. _pylint: http://pypi.python.org/pypi/pylint
+.. _flake8: http://pypi.python.org/pypi/flake8
Please sign in to comment.
Something went wrong with that request. Please try again.