summaryrefslogtreecommitdiff
path: root/pylint/checkers/misc.py
diff options
context:
space:
mode:
authorBenny <benny.mueller91@gmail.com>2020-02-13 09:30:43 +0100
committerGitHub <noreply@github.com>2020-02-13 09:30:43 +0100
commit8956979db811cabc0d96a5f256e3001574e59a00 (patch)
treeae66a7f903420497e2482765a25d49009d55d653 /pylint/checkers/misc.py
parent5f49ac2835afc1d5d1d19db763b122d51f145cdf (diff)
downloadpylint-git-8956979db811cabc0d96a5f256e3001574e59a00.tar.gz
Add notes-rgx option for fixme checker (#3394)
This commit adds a new `notes-rgx` which is used by the "fixme" check for more granular control over the what fixme messages to emit. Co-authored-by: Claudiu Popa <pcmanticore@gmail.com>
Diffstat (limited to 'pylint/checkers/misc.py')
-rw-r--r--pylint/checkers/misc.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/pylint/checkers/misc.py b/pylint/checkers/misc.py
index 18e532514..01947b3aa 100644
--- a/pylint/checkers/misc.py
+++ b/pylint/checkers/misc.py
@@ -94,13 +94,26 @@ class EncodingChecker(BaseChecker):
),
},
),
+ (
+ "notes-rgx",
+ {
+ "type": "string",
+ "metavar": "<regexp>",
+ "help": "Regular expression of note tags to take in consideration.",
+ },
+ ),
)
def open(self):
super().open()
- self._fixme_pattern = re.compile(
- r"#\s*(%s)\b" % "|".join(map(re.escape, self.config.notes)), re.I
- )
+
+ notes = "|".join(map(re.escape, self.config.notes))
+ if self.config.notes_rgx:
+ regex_string = r"#\s*(%s|%s)\b" % (notes, self.config.notes_rgx)
+ else:
+ regex_string = r"#\s*(%s)\b" % (notes)
+
+ self._fixme_pattern = re.compile(regex_string, re.I)
def _check_encoding(self, lineno, line, file_encoding):
try: