From 5f9a324fe4cf7e10fe2981ec9ad92ca0836de387 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 28 Jun 2009 18:40:05 +0000 Subject: [PATCH] Check for redundant blank lines. Thanks to Markus Meier for this patch. svn path=/main/trunk/; revision=13725 --- pym/repoman/checks.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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, -- 2.26.2