Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Recommended flake8 to check coding style.

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

0 notes on commit 14c1872

Please sign in to comment.
Something went wrong with that request. Please try again.