diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-06-09 10:36:58 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-06-12 08:20:25 -0400 |
commit | a798c130b3adc6c336856243a14175d4bd7c770f (patch) | |
tree | b29a8e5bee58bf4ba29915086c4b1c27a424267f /.gitlab/linters/linter.py | |
parent | b09374a4a839c2587a738698133465c4b9277c3b (diff) | |
download | haskell-a798c130b3adc6c336856243a14175d4bd7c770f.tar.gz |
linters/check-makefiles: Limit lint to Makefiles
Previously we would apply this rule, which is only intended for
testsuite Makefiles, to all files. This lead to a number of
false-positives in all.T files.
Diffstat (limited to '.gitlab/linters/linter.py')
-rw-r--r-- | .gitlab/linters/linter.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/.gitlab/linters/linter.py b/.gitlab/linters/linter.py index ec4f3581a8..a5cdd179b7 100644 --- a/.gitlab/linters/linter.py +++ b/.gitlab/linters/linter.py @@ -73,13 +73,14 @@ class RegexpLinter(LineLinter): A :class:`RegexpLinter` produces the given warning message for all lines matching the given regular expression. """ - def __init__(self, regex, message): + def __init__(self, regex, message, path_filter=lambda path: True): LineLinter.__init__(self) self.re = re.compile(regex) self.message = message + self.path_filter = path_filter def lint_line(self, path, line_no, line): - if self.re.search(line): + if self.path_filter(path) and self.re.search(line): w = Warning(path=path, line_no=line_no, line_content=line[:-1], message=self.message) self.add_warning(w) |