On 01:09 Sat 29 Sep     , Donnie Berkholz wrote:
> I put together a quick repoman patch to check for the quoting issues 
> that've kept coming up in reviews lately. Give it a shot and fix it if 
> you have problems.
> 
> Thanks,
> Donnie

Woops, the last one didn't exclude [[ ]] cases properly because I 
screwed up the second regexp. Try this.

Thanks,
Donnie
--- repoman.orig        2007-09-29 00:05:30.000000000 -0700
+++ repoman     2007-09-29 01:33:27.000000000 -0700
@@ -188,6 +188,7 @@
        "ebuild.majorsyn":"This ebuild has a major syntax error that may cause 
the ebuild to fail partially or fully",
        "ebuild.minorsyn":"This ebuild has a minor syntax error that 
contravenes gentoo coding style",
        "ebuild.badheader":"This ebuild has a malformed header",
+       "ebuild.quoting":"This ebuild may fail to quote D, S, T, FILESDIR, or 
WORKDIR",
        "metadata.missing":"Missing metadata.xml files",
        "metadata.bad":"Bad metadata.xml files",
        "virtual.versioned":"PROVIDE contains virtuals with versions",
@@ -218,6 +219,7 @@
 "RESTRICT.invalid",
 "ebuild.minorsyn",
 "ebuild.badheader",
+"ebuild.quoting",
 "file.size",
 "metadata.missing",
 "metadata.bad",
@@ -1329,6 +1331,8 @@
                ignore_line = re.compile(r'(^$)|(^(\t)*#)')
                leading_spaces = re.compile(r'^[\S\t]')
                trailing_whitespace = re.compile(r'.*([\S]$)')
+               missing_quotes = 
re.compile(r'[^"]\${?(D|S|T|FILESDIR|WORKDIR)}?\W')
+               missing_quotes_exclude = 
re.compile(r'\[\[.*[^"]\${?(D|S|T|FILESDIR|WORKDIR)}?\W.*\]\]')
                readonly_assignment = 
re.compile(r'^\s*(export\s+)?(A|CATEGORY|P|PV|PN|PR|PVR|PF|D|WORKDIR|FILESDIR|FEATURES|USE)=')
                line_continuation = re.compile(r'([^#]*\S)(\s+|\t)\\$')
                linenum=0
@@ -1374,6 +1378,17 @@
                                                myerrormsg = "Trailing 
whitespace Syntax Error. Line %d" % linenum
                                                stats["ebuild.minorsyn"] +=1
                                                
fails["ebuild.minorsyn"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
+                                       # Missing quotes check
+                                       missing_quotes_line = 
missing_quotes.search(line)
+                                       if missing_quotes_line:
+                                               for group in 
missing_quotes_line.group():
+                                                       match = 
missing_quotes_exclude.search(group)
+                                                       if not match:
+                                                               myerrormsg = 
"Missing Quotes Error. Line %d" % linenum
+                                                               
stats["ebuild.quoting"] += 1
+                                                               
fails["ebuild.quoting"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
+                                                               # Only need 1 
match in a line to count the line
+                                                               break
                                        # Readonly variable assignment check
                                        match = readonly_assignment.match(line)
                                        # The regex can give a false positive 
for continued lines,

Reply via email to