In the EbuildQuote check, combine the var_assignment
authorZac Medico <zmedico@gentoo.org>
Wed, 3 Oct 2007 00:12:18 +0000 (00:12 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 3 Oct 2007 00:12:18 +0000 (00:12 -0000)
regex together with the ignore_line regex. This also
fixes an issue with the var_assignment regex allowing
violations like `make DESTDIR=${D}` to slip through.

svn path=/main/trunk/; revision=7904

pym/repoman/checks.py

index de7ceee23f94af52f0aa35d954b3a7c4d090a359..d30785aed3e48a1f2d7033170c0b34b2d1714734 100644 (file)
@@ -118,13 +118,12 @@ class EbuildQuote(ContentCheck):
        """Ensure ebuilds have valid quoting around things like D,FILESDIR, etc..."""
 
        repoman_check_name = 'ebuild.minorsyn'
-       ignore_line = re.compile(r'(^$)|(^\s*#.*)')
+       ignore_line = re.compile(r'(^$)|(^\s*#.*)|(^\s*\w+=.*)')
        var_names = r'(D|S|T|ROOT|FILESDIR|WORKDIR)'
        var_reference = re.compile(r'\$({'+var_names+'}|' + \
                r'\$' + var_names + '\W)')
        missing_quotes = re.compile(r'(\s|^)[^"\s]*\${?' + var_names + \
                r'}?[^"\s]*(\s|$)')
-       var_assignment = re.compile(r'^\s*\w*=.*')
        cond_begin =  re.compile(r'(^|\s+)\[\[($|\\$|\s+)')
        cond_end =  re.compile(r'(^|\s+)\]\]($|\\$|\s+)')
        
@@ -161,8 +160,6 @@ class EbuildQuote(ContentCheck):
                                # get through the missing_quotes regex.
                                if self.var_reference.search(group) is None:
                                        continue
-                               if self.var_assignment.search(group) is not None:
-                                       continue
 
                                # This is an attempt to avoid false positives without getting
                                # too complex, while possibly allowing some (hopefully