mirror of
https://fuchsia.googlesource.com/third_party/github.com/pylint-dev/pylint
synced 2024-09-21 07:58:04 +00:00
Notes (TODO, XXX etc) are now searched for using a simple in
before resorting to the regular expression, in order to avoid using the regexp on every line and to prevent a pathological problem for extremely long lines (50k+ characters)
This commit is contained in:
parent
13fa29e012
commit
2e802e8af7
|
@ -54,6 +54,17 @@ class EncodingChecker(BaseChecker):
|
|||
'separated by a comma.')}),)
|
||||
|
||||
def _check_note(self, notes, lineno, line):
|
||||
# First, simply check if the notes are in the line at all. This is an
|
||||
# optimisation to prevent using the regular expression on every line,
|
||||
# but rather only on lines which may actually contain one of the notes.
|
||||
# This prevents a pathological problem with lines that are hundreds
|
||||
# of thousands of characters long.
|
||||
for note in self.config.notes:
|
||||
if note in line:
|
||||
break
|
||||
else:
|
||||
return
|
||||
|
||||
match = notes.search(line)
|
||||
if not match:
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue
Block a user