Fix some more test details.

This commit is contained in:
Dave Halter
2017-07-06 21:58:24 +02:00
parent b2e35bc573
commit b3f42a8920
4 changed files with 14 additions and 14 deletions

View File

@@ -21,6 +21,7 @@ _NEEDS_SPACE = ('=', '%', '->',
'>>=', '**=', '//=')
_NEEDS_SPACE += _BITWISE_OPERATOR
_IMPLICIT_INDENTATION_TYPES = ('dictorsetmaker', 'argument')
_POSSIBLE_SLICE_PARENTS = ('subscript', 'subscriptlist', 'sliceop')
class CompressNormalizer(Normalizer):
"""
@@ -428,7 +429,7 @@ class PEP8Normalizer(Normalizer):
+ self._config.indentation:
self.add_issue(129, "Line with same indent as next logical block", leaf)
elif indentation != should_be_indentation:
if not self._check_tabs_spaces(spacing):
if not self._check_tabs_spaces(spacing) and leaf.value != '\n':
if value in '])}':
if node.type == IndentationTypes.VERTICAL_BRACKET:
self.add_issue(124, "Closing bracket does not match visual indentation", leaf)
@@ -550,13 +551,13 @@ class PEP8Normalizer(Normalizer):
message = "Whitespace before '%s'" % leaf.value
add_if_spaces(202, message, spacing)
elif leaf in (',', ';') or leaf == ':' \
and leaf.parent.type not in ('subscript', 'subscriptlist'):
and leaf.parent.type not in _POSSIBLE_SLICE_PARENTS:
message = "Whitespace before '%s'" % leaf.value
add_if_spaces(203, message, spacing)
elif prev == ':' and prev.parent.type in ('subscript', 'subscriptlist'):
elif prev == ':' and prev.parent.type in _POSSIBLE_SLICE_PARENTS:
pass # TODO
elif prev in (',', ';', ':'):
add_not_spaces('231', "missing whitespace after '%s'", spacing)
add_not_spaces(231, "missing whitespace after '%s'", spacing)
elif leaf == ':': # Is a subscript
# TODO
pass

View File

@@ -66,6 +66,7 @@ abricot = 3 + \
print "hello", (
"there",
#: E126:5
# "john",
"dude")
part = set_mimetype((

View File

@@ -39,9 +39,7 @@ setup('',
])
#TODO
##: W291
#: E123+2:4
#: E123+2:4 E291:15
print "E123", (
"bad", "hanging", "close"
)
@@ -117,15 +115,15 @@ def long_function_name(
def qualify_by_address(
#: E129
#: E129:4 E129+1:4
self, cr, uid, ids, context=None,
#: E129
params_to_check=frozenset(QUALIF_BY_ADDRESS_PARAM)):
""" This gets called by the web server """
#: E129+1:4 E129+2:4
if (a == 2 or
#: E129
b == "abc def ghi"
#: E129
"jkl mno"):
return True

View File

@@ -79,12 +79,12 @@ if True:
return [node.copy(
#: E121:12
(
#: E121
#: E121:16 E126+1:24 E126+2:24
replacement
# First, look at all the node's current children.
for child in node.children
#: E121
for replacement in replace(child)
#: E123
),
dict(name=token.undefined)
)]
@@ -105,7 +105,7 @@ print dedent(
mkdir -p ./{build}/
mv ./build/ ./{build}/%(revision)s/
'''.format(
#: E121:4 E123+2:0
#: E121:4 E121+1:4 E123+2:0
build='build',
# more stuff
)