Add length checks for line lengths.

This commit is contained in:
Dave Halter
2017-07-02 20:17:55 +02:00
parent 3057d15a4d
commit d9ebb09e64
2 changed files with 11 additions and 3 deletions

View File

@@ -421,6 +421,13 @@ class PEP8Normalizer(Normalizer):
self._check_spacing(leaf, spacing)
self._analyse_non_prefix(leaf)
last_column = leaf.end_pos[1]
if last_column > self._config.max_characters:
self.add_issue(
501,
'Line too long (%s > %s characters)' % (last_column, self._config.max_characters),
leaf
)
# -------------------------------
# Finalizing. Updating the state.
@@ -622,6 +629,7 @@ class PEP8NormalizerConfig(NormalizerConfig):
self.hanging_indentation = hanging_indentation
self.closing_bracket_hanging_indentation = ''
self.break_after_binary = False
self.max_characters = 79
@PEP8NormalizerConfig.register_rule