summaryrefslogtreecommitdiffstats
path: root/pym/repoman/checks.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/repoman/checks.py')
-rw-r--r--pym/repoman/checks.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py
index dd81d8716..c9415b759 100644
--- a/pym/repoman/checks.py
+++ b/pym/repoman/checks.py
@@ -83,8 +83,11 @@ class EbuildQuote(LineCheck):
"""Ensure ebuilds have valid quoting around things like D,FILESDIR, etc..."""
repoman_check_name = 'ebuild.minorsyn'
- _ignored_commands = ["echo", "local", "export"]
- _ignored_commands += ["eerror", "einfo", "elog", "eqawarn", "ewarn"]
+ _message_commands = ["die", "echo", "eerror",
+ "einfo", "elog", "eqawarn", "ewarn"]
+ _message_re = re.compile(r'\s(' + "|".join(_message_commands) + \
+ r')\s+"[^"]*"\s*$')
+ _ignored_commands = ["local", "export"] + _message_commands
ignore_line = re.compile(r'(^$)|(^\s*#.*)|(^\s*\w+=.*)' + \
r'|(^\s*(' + "|".join(_ignored_commands) + r')\s+)')
var_names = ["D", "DISTDIR", "FILESDIR", "S", "T", "ROOT", "WORKDIR"]
@@ -125,6 +128,15 @@ class EbuildQuote(LineCheck):
if self.var_reference.search(group) is None:
continue
+ # Filter matches that appear to be an
+ # argument to a message command.
+ # For example: false || ewarn "foo $WORKDIR/bar baz"
+ message_match = self._message_re.search(line)
+ if message_match is not None and \
+ message_match.start() < pos and \
+ message_match.end() > pos:
+ break
+
# This is an attempt to avoid false positives without getting
# too complex, while possibly allowing some (hopefully
# unlikely) violations to slip through. We just assume