diff --git a/pylint/checkers/misc.py b/pylint/checkers/misc.py index 0b098e8199..8948a75082 100644 --- a/pylint/checkers/misc.py +++ b/pylint/checkers/misc.py @@ -10,6 +10,7 @@ # Copyright (c) 2016 glegoux # Copyright (c) 2017-2018 hippo91 # Copyright (c) 2017 Mikhail Fesenko +# Copyright (c) 2018 Ville Skyttä # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html # For details: https://github.com/PyCQA/pylint/blob/master/COPYING @@ -97,17 +98,6 @@ def _check_note(self, notes, lineno, line, module_last_lineno): commented lines exist at the end of the module) :type module_last_lineno: int """ - # 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 map(str.lower, self.config.notes): - if note in line.lower(): - break - else: - return - match = notes.search(line) if not match: return @@ -151,7 +141,7 @@ def process_module(self, module): """ if self.config.notes: notes = re.compile( - r'.*?#\s*(%s)(:*\s*.*)' % "|".join(self.config.notes), re.I) + r'#\s*(%s)\b' % "|".join(map(re.escape, self.config.notes)), re.I) else: notes = None if module.file_encoding: diff --git a/pylint/test/functional/fixme.py b/pylint/test/functional/fixme.py index 7857538e05..298355d4a1 100644 --- a/pylint/test/functional/fixme.py +++ b/pylint/test/functional/fixme.py @@ -21,3 +21,4 @@ def function(): #FIXME: in fact nothing to fix #pylint: disable=fixme #TODO: in fact nothing to do #pylint: disable=fixme #TODO: in fact nothing to do #pylint: disable=line-too-long, fixme + # Todoist API mentioned should not result in a message.