mirror of
https://github.com/davidhalter/parso.git
synced 2026-08-13 03:21:02 +08:00
Add length checks for line lengths.
This commit is contained in:
@@ -421,6 +421,13 @@ class PEP8Normalizer(Normalizer):
|
|||||||
self._check_spacing(leaf, spacing)
|
self._check_spacing(leaf, spacing)
|
||||||
|
|
||||||
self._analyse_non_prefix(leaf)
|
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.
|
# Finalizing. Updating the state.
|
||||||
@@ -622,6 +629,7 @@ class PEP8NormalizerConfig(NormalizerConfig):
|
|||||||
self.hanging_indentation = hanging_indentation
|
self.hanging_indentation = hanging_indentation
|
||||||
self.closing_bracket_hanging_indentation = ''
|
self.closing_bracket_hanging_indentation = ''
|
||||||
self.break_after_binary = False
|
self.break_after_binary = False
|
||||||
|
self.max_characters = 79
|
||||||
|
|
||||||
|
|
||||||
@PEP8NormalizerConfig.register_rule
|
@PEP8NormalizerConfig.register_rule
|
||||||
|
|||||||
@@ -21,15 +21,15 @@
|
|||||||
# 情 情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情
|
# 情 情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情
|
||||||
|
|
||||||
#
|
#
|
||||||
#: E501
|
|
||||||
# 80 narrow chars (Na)
|
# 80 narrow chars (Na)
|
||||||
|
#: E501
|
||||||
# 01 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 [80]
|
# 01 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 [80]
|
||||||
#
|
#
|
||||||
#: E501
|
|
||||||
# 78 narrow chars (Na) + 2 wide char (W)
|
# 78 narrow chars (Na) + 2 wide char (W)
|
||||||
|
#: E501
|
||||||
# 01 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8情情
|
# 01 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8情情
|
||||||
#
|
#
|
||||||
#: E501
|
|
||||||
# 3 narrow chars (Na) + 77 wide chars (W)
|
# 3 narrow chars (Na) + 77 wide chars (W)
|
||||||
|
#: E501
|
||||||
# 情 情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情
|
# 情 情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情情
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user