|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PEP8 has some specific recommendations early on which relate to
indenting continuation lines. Specifically, it distinguishes between
'visual indenting' and 'hanging indents'. This change implements these
rules, adding several new errors (for now):
* E120 - traps on a visual indent with hanging indent lines following
* E121 - traps overly–indented lines inside visual indent regions
* E122 - catches the evil and wrong indenting default that emacs'
python-mode applies to 'loose fingernails' (not canonical)
* E123 - catches continuation lines missing extra indentation when the
previous line started a hanging indent
* E124 - catches continuation lines not aligned on 4 spaces; note this
required a fix to the E23.py test
* E125 - catches continuation lines with 8 or more space indents
relative to the previous line without good reason
* E126 - ensures that indentation leaves blocks visually distinct
All of these errors are directly justifiable from text and examples in
the PEP8 document, and some examples are directly copied from PEP8. The
exception to this is E122, which the PEP8 standard appears neutral on
but nonetheless I feel is intrinsically related with the rules which are
defined here; to not enforce it would permit multiple valid indent
levels for closing brackets which start lines, leading to ambiguity.
All the PEP8 examples leave the closing bracket on the previous line,
avoiding this question. This E122 rule agrees with K&R, KNF, Linux,
this VIM auto–indent script:
http://www.vim.org/scripts/script.php?script_id=974
and the fix to python-mode achieved by the elisp fragment on:
http://stackoverflow.com/revisions/5361478/2
See testsuite/E12.py for many examples.
|