diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-06-28 18:40:05 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-06-28 18:40:05 +0000 |
commit | 5f9a324fe4cf7e10fe2981ec9ad92ca0836de387 (patch) | |
tree | 9df815a99cf31a9956943a81b3e5df82ed0ca363 | |
parent | 0db2a617938c50900e75cf52c767c3acf6647b76 (diff) | |
download | portage-5f9a324fe4cf7e10fe2981ec9ad92ca0836de387.tar.gz portage-5f9a324fe4cf7e10fe2981ec9ad92ca0836de387.tar.bz2 portage-5f9a324fe4cf7e10fe2981ec9ad92ca0836de387.zip |
Check for redundant blank lines. Thanks to Markus Meier <maekke@gentoo.org>
for this patch.
svn path=/main/trunk/; revision=13725
-rw-r--r-- | pym/repoman/checks.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index 915f989f2..4c2bcd113 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -82,6 +82,25 @@ class EbuildWhitespace(LineCheck): if self.trailing_whitespace.match(line) is None: return errors.TRAILING_WHITESPACE_ERROR +class EbuildBlankLine(LineCheck): + repoman_check_name = 'ebuild.minorsyn' + blank_line = re.compile(r'^$') + + def new(self, pkg): + self.line_is_blank = False + + def check(self, num, line): + if self.line_is_blank and self.blank_line.match(line): + return 'Useless blank line on line: %d' + if self.blank_line.match(line): + self.line_is_blank = True + else: + self.line_is_blank = False + + def end(self): + if self.line_is_blank: + yield 'Useless blank line on last line' + class EbuildQuote(LineCheck): """Ensure ebuilds have valid quoting around things like D,FILESDIR, etc...""" @@ -471,7 +490,7 @@ class Eapi3GoneVars(LineCheck): _constant_checks = tuple((c() for c in ( - EbuildHeader, EbuildWhitespace, EbuildQuote, + EbuildHeader, EbuildWhitespace, EbuildBlankLine, EbuildQuote, EbuildAssignment, EbuildUselessDodoc, EbuildUselessCdS, EbuildNestedDie, EbuildPatches, EbuildQuotedA, EapiDefinition, |