summaryrefslogtreecommitdiff
path: root/pylint/checkers/format.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2022-11-01 08:06:26 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2022-11-05 10:43:35 +0100
commit51bba373f8c546b84db9aea66a1ac24f3ebf948a (patch)
tree93d440c8d21fb5f58c3257e1803fa3cf317bf295 /pylint/checkers/format.py
parent83b389198cf8d05c9945d381e2bb3781b887ca29 (diff)
downloadpylint-git-51bba373f8c546b84db9aea66a1ac24f3ebf948a.tar.gz
[flake8-bugbear] Simplify line_length_warning in the formatting checker
Diffstat (limited to 'pylint/checkers/format.py')
-rw-r--r--pylint/checkers/format.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/pylint/checkers/format.py b/pylint/checkers/format.py
index d33def5b5..3cb3d5980 100644
--- a/pylint/checkers/format.py
+++ b/pylint/checkers/format.py
@@ -676,15 +676,11 @@ class FormatChecker(BaseTokenChecker, BaseRawFileChecker):
if tokens.type(line_start) != tokenize.STRING:
self.check_trailing_whitespace_ending(line, lineno + offset)
- # hold onto the initial lineno for later
- potential_line_length_warning = False
- for offset, line in enumerate(split_lines):
- # this check is purposefully simple and doesn't rstrip
- # since this is running on every line you're checking it's
- # advantageous to avoid doing a lot of work
- if len(line) > max_chars:
- potential_line_length_warning = True
- break
+ # This check is purposefully simple and doesn't rstrip since this is running
+ # on every line you're checking it's advantageous to avoid doing a lot of work
+ potential_line_length_warning = any(
+ len(line) > max_chars for line in split_lines
+ )
# if there were no lines passing the max_chars config, we don't bother
# running the full line check (as we've met an even more strict condition)