summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2012-12-09 22:18:07 +0100
committerFlorent Xicluna <florent.xicluna@gmail.com>2012-12-09 22:18:07 +0100
commitd825250fe45c0d2f48ada14e70b0f838c7b91ee0 (patch)
treea9f8d36d140abe3bf673788e9dd534402a91aca4
parented07ac0a33bad5d3bb9e150589213b3e97f0edb1 (diff)
downloadpep8-d825250fe45c0d2f48ada14e70b0f838c7b91ee0.tar.gz
Fix false E126 with indented comments; issue #138
-rw-r--r--CHANGES.txt4
-rwxr-xr-xpep8.py3
-rw-r--r--testsuite/E12not.py6
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)
diff --git a/pep8.py b/pep8.py
index cc20fa1..524fed2 100755
--- a/pep8.py
+++ b/pep8.py
@@ -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
+]
#