diff options
author | cpopa <devnull@localhost> | 2014-08-24 22:03:35 +0300 |
---|---|---|
committer | cpopa <devnull@localhost> | 2014-08-24 22:03:35 +0300 |
commit | 4f2e84100881fd39c0fe6e997f769730b4d32450 (patch) | |
tree | f8e5f3912a9c55a6cd5c8d56d1361bf6736960fe /checkers/misc.py | |
parent | ab071ab64fdb7b05f188247a0366165d575c130e (diff) | |
download | pylint-4f2e84100881fd39c0fe6e997f769730b4d32450.tar.gz |
Other backports from default.
Diffstat (limited to 'checkers/misc.py')
-rw-r--r-- | checkers/misc.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/checkers/misc.py b/checkers/misc.py index b53f882..b27b86a 100644 --- a/checkers/misc.py +++ b/checkers/misc.py @@ -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 |