diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2012-12-09 22:18:07 +0100 |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2012-12-09 22:18:07 +0100 |
commit | d825250fe45c0d2f48ada14e70b0f838c7b91ee0 (patch) | |
tree | a9f8d36d140abe3bf673788e9dd534402a91aca4 | |
parent | ed07ac0a33bad5d3bb9e150589213b3e97f0edb1 (diff) | |
download | pep8-d825250fe45c0d2f48ada14e70b0f838c7b91ee0.tar.gz |
Fix false E126 with indented comments; issue #138
-rw-r--r-- | CHANGES.txt | 4 | ||||
-rwxr-xr-x | pep8.py | 3 | ||||
-rw-r--r-- | testsuite/E12not.py | 6 |
3 files changed, 11 insertions, 2 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 2cf136d..ed2af48 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -13,7 +13,9 @@ Changelog * Report E231 for nested dictionary in list. (Issue #142) -* Catch ``E271`` at the beginning of the line. (Issue #133) +* Catch E271 at the beginning of the line. (Issue #133) + +* Fix false positive E126. (Issue #138) * Fix ``--diff`` failing on one-line hunk. (Issue #137) @@ -549,7 +549,8 @@ def continuation_line_indentation(logical_line, tokens, indent_level, verbose): if verbose >= 4: print("bracket depth %s indent to %s" % (depth, start[1])) # deal with implicit string concatenation - elif token_type == tokenize.STRING or text in ('u', 'ur', 'b', 'br'): + elif (token_type in (tokenize.STRING, tokenize.COMMENT) or + text in ('u', 'ur', 'b', 'br')): indent_chances[start[1]] = str # keep track of bracket depth diff --git a/testsuite/E12not.py b/testsuite/E12not.py index 59e5113..9f9bef2 100644 --- a/testsuite/E12not.py +++ b/testsuite/E12not.py @@ -535,4 +535,10 @@ try: %s -d5 d = { # comment 1: 2 } + +# issue #138 +[ + 12, # this is a multi-line inline + # comment +] # |