On 10/09/2013 12:38 PM, Tim Graham wrote:
> I'd like to propose cleaning up Django's codebase so that we can run
> flake8 (with some rules ignored) as a presubmit check (for example,
> hooked into pull request submissions).
>
> Our docs currently state: "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." I
> somewhat disagree, I think it's better to make cleanups in separate
> commits so that when looking at a commit, you don't need to figure out
> what changes are stylistic and what changes are needed for the fix.
>
> The benefit of doing the cleanup now is that we could automate these
> style checks afterward which will make code review more efficient. As
> Alex wrote in his blog post on code review
> <
http://alexgaynor.net/2013/sep/26/effective-code-review/>: "Don't use
> humans to check for things a machine can. This means that code review
> isn't a process of running your tests, or looking for style guide
> violations."
>
> A drawback is that it will introduce some noise in the commit history in
> the short term and make git blame less efficient. I believe the long
> term benefit of not being at war with these issues is worth this trade-off.
>
> If accepted, I'll put together a more concrete proposal that includes
> which errors we'll ignore, etc.
+1 from me.
And I agree that dedicated comprehensive style cleanup commits are much
better than mixing it in with functional commits "when you're in the
area"; I'd support changing that paragraph in our docs (though it
shouldn't be relevant anymore once you've done one comprehensive pass
and integrated an automated flake8 in the PR process).
Carl