Don't add issues if we're in an error node.

This commit is contained in:
Dave Halter
2017-06-15 19:31:23 +02:00
parent 0f2e6f9e22
commit 7a758dabd8

View File

@@ -395,6 +395,19 @@ class PEP8Normalizer(Normalizer):
return leaf.value
def add_issue(self, code, message, node):
try:
parent = node.parent
except AttributeError:
# TODO for prefix parts, there's no parents yet.
pass
else:
while parent:
if parent.type == 'error_node':
return
parent = parent.parent
super(PEP8Normalizer, self).add_issue(code, message, node)
class PEP8NormalizerConfig(NormalizerConfig):
normalizer_class = PEP8Normalizer