summaryrefslogtreecommitdiff
path: root/.gitlab
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-06-09 10:36:58 -0400
committerBen Gamari <ben@smart-cactus.org>2019-06-12 08:20:25 -0400
commita798c130b3adc6c336856243a14175d4bd7c770f (patch)
treeb29a8e5bee58bf4ba29915086c4b1c27a424267f /.gitlab
parentb09374a4a839c2587a738698133465c4b9277c3b (diff)
downloadhaskell-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')
-rwxr-xr-x.gitlab/linters/check-makefiles.py3
-rw-r--r--.gitlab/linters/linter.py5
2 files changed, 5 insertions, 3 deletions
diff --git a/.gitlab/linters/check-makefiles.py b/.gitlab/linters/check-makefiles.py
index 4e4924cdbc..0a82a99d41 100755
--- a/.gitlab/linters/check-makefiles.py
+++ b/.gitlab/linters/check-makefiles.py
@@ -12,7 +12,8 @@ from linter import run_linters, RegexpLinter
linters = [
RegexpLinter(r'--interactive',
- message = "Warning: Use `$(TEST_HC_OPTS_INTERACTIVE)` instead of `--interactive -ignore-dot-ghci -v0`.")
+ message = "Warning: Use `$(TEST_HC_OPTS_INTERACTIVE)` instead of `--interactive -ignore-dot-ghci -v0`.",
+ path_filter = lambda path: path == 'Makefile')
]
if __name__ == '__main__':
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)