summaryrefslogtreecommitdiffstats
path: root/pym/repoman/checks.py
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2007-10-01 12:27:45 +0000
committerAlec Warner <antarus@gentoo.org>2007-10-01 12:27:45 +0000
commit06c25cd3f55b72d5c92555e4f3f25af83a19466a (patch)
tree180d99884e5cd1096b4b607fa846f2651bf76108 /pym/repoman/checks.py
parent6116442e81d57fe4c65186f07fe26c5568065b55 (diff)
downloadportage-06c25cd3f55b72d5c92555e4f3f25af83a19466a.tar.gz
portage-06c25cd3f55b72d5c92555e4f3f25af83a19466a.tar.bz2
portage-06c25cd3f55b72d5c92555e4f3f25af83a19466a.zip
Rename checks as the naming was overkill (they are all obviously checks being in the check module), add nesteddie check
svn path=/main/trunk/; revision=7898
Diffstat (limited to 'pym/repoman/checks.py')
-rw-r--r--pym/repoman/checks.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py
index ac79b990e..7ec670804 100644
--- a/pym/repoman/checks.py
+++ b/pym/repoman/checks.py
@@ -9,7 +9,7 @@ import os
from repoman.errors import COPYRIGHT_ERROR, LICENSE_ERROR, CVS_HEADER_ERROR, \
LEADING_SPACES_ERROR, READONLY_ASSIGNMENT_ERROR, TRAILING_WHITESPACE_ERROR, \
- MISSING_QUOTES_ERROR
+ MISSING_QUOTES_ERROR, NESTED_DIE_ERROR
class ContentCheckException(Exception):
@@ -41,7 +41,7 @@ class ContentCheck(object):
pass
-class EbuildHeaderCheck(ContentCheck):
+class EbuildHeader(ContentCheck):
"""Ensure ebuilds have proper headers
Args:
@@ -84,7 +84,7 @@ class EbuildHeaderCheck(ContentCheck):
return errors
-class EbuildWhitespaceCheck(ContentCheck):
+class EbuildWhitespace(ContentCheck):
"""Ensure ebuilds have proper whitespacing"""
repoman_check_name = 'ebuild.minorsyn'
@@ -114,7 +114,7 @@ class EbuildWhitespaceCheck(ContentCheck):
return errors
-class EbuildQuoteCheck(ContentCheck):
+class EbuildQuote(ContentCheck):
"""Ensure ebuilds have valid quoting around things like D,FILESDIR, etc..."""
repoman_check_name = 'ebuild.minorsyn'
@@ -146,7 +146,7 @@ class EbuildQuoteCheck(ContentCheck):
return errors
-class EbuildAssignmentCheck(ContentCheck):
+class EbuildAssignment(ContentCheck):
"""Ensure ebuilds don't assign to readonly variables."""
repoman_check_name = 'variable.readonly'
@@ -175,3 +175,20 @@ class EbuildAssignmentCheck(ContentCheck):
errors.append((num + 1, READONLY_ASSIGNMENT_ERROR))
previous_line = line
return errors
+
+class EbuildNestedDie(ContentCheck):
+ """Check ebuild for nested die statements (die statements in subshells"""
+
+ repoman_check_name = 'ebuild.nesteddie'
+ nesteddie_re = re.compile(r'^[^#]*\([^)]*\bdie\b')
+
+ def __init__(self, contents):
+ ContentCheck.__init__(self, contents)
+
+ def Run(self):
+ errors = []
+ for num, line in enumerate(self.contents):
+ match = self.nesteddie_re.match(line)
+ if match:
+ errors.append((num + 1, NESTED_DIE_ERROR))
+ return errors