leading_spaces = re.compile(r'^[\S\t]')
trailing_whitespace = re.compile(r'.*([\S]$)')
readonly_assignment = re.compile(r'^\s*(export\s+)?(A|CATEGORY|P|PV|PN|PR|PVR|PF|D|WORKDIR|FILESDIR|FEATURES|USE)=')
- continuation_symbol = re.compile(r'(.*[ ]+[\\][ ].*)')
- line_continuation_quoted = re.compile(r'(\"|\'|`)(([\w ,:;#\[\]\.`=/|\$\^\*{}()\'-])|(\\.))*\1')
line_continuation = re.compile(r'([^#]*\S)(\s+|\t)\\$')
linenum=0
previous_line = None
myerrormsg = "Readonly variable assignment to %s on line %d" % (match.group(2), linenum)
stats["variable.readonly"] += 1
fails["variable.readonly"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
- # Line continuation check
- match = continuation_symbol.match(line)
- if match:
- #Excluded lines not even containing a " \" match. Good!
- line = re.sub(line_continuation_quoted,"\"\"",line)
- # line has been edited to collapse "", '', and ``
- # quotes to "". Good!
- match = continuation_symbol.match(line)
- if match:
- #Again exclude lines not even containing a " \" match. Good!
- #This repetition is done for a slight performance increase
- match = line_continuation.match(line)
- if not match:
- #Line has a line continuation error. Bad!
- myerrormsg = "Line continuation (\"\\\") Syntax Error. Line %d" % linenum
- stats["ebuild.majorsyn"] +=1
- fails["ebuild.majorsyn"].append(x+"/"+y+".ebuild: %s" % myerrormsg)
previous_line = line
del previous_line