rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
while (line.number - jLine < 8 and jLine > 0 and len(lines[jLine].stripped) > nLead): if ( not re.search("[\(\s]", lines[jLine].stripped[nLead - 1]) ): isBracketAligned = False | while (line.number - jLine < 8 and jLine > 0): if len(lines[jLine].stripped) < (nLead + 1) or nLead == 0: jLine -= 1 continue if ( (re.search("[\)\]]", line.stripped[nLead]) and re.search("[\(\[]", lines[jLine].stripped[nLead]) ) or re.search("\(", lines[jLine].stripped[nLead - 1]) ): isBracketAligned = True | def apply(self, lines): vList = [] # don't enforce this for line continuation of argument lists or other parenthesized statements inParentheses = False if (self.getFiletype() in self.getTypeList()): for line in lines: if (re.search("\([^\)]+$", line.stripped)): inParentheses = True m = re.search("^(\s*)[^\s]", line.s... |
if ( re.search("\(", lines[jLine].stripped[nLead - 1])): break | def apply(self, lines): vList = [] # don't enforce this for line continuation of argument lists or other parenthesized statements inParentheses = False if (self.getFiletype() in self.getTypeList()): for line in lines: if (re.search("\([^\)]+$", line.stripped)): inParentheses = True m = re.search("^(\s*)[^\s]", line.s... | |
Test.__init__(self, 1, "^.+(class|private|protected|public):", "6-5", "class/public/protected/private should be left justified.", filetype, ["c", "cc", "h"]) | Test.__init__(self, 1, "", "6-5", "class/public/protected/private should be left justified.", filetype, ["c", "cc", "h"]) def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if (re.search("^.+(class|private|protected|public):", line.stripped) and not line.inNestedClass):... | def __init__(self, filetype): Test.__init__(self, 1, "^.+(class|private|protected|public):", "6-5", "class/public/protected/private should be left justified.", filetype, ["c", "cc", "h"]) |
isDefault = isDefaultSameLine or isDefaultDiffLine | mOvr = re.search("operator=\(", line.stripped) isDefault = isDefaultSameLine or isDefaultDiffLine or mOvr | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: |
mPosP = re.search("[\:\=\+\-\*\/\(\,\<\>]\s*\+", match) | mPosP = re.search("[\:\=\+\-\*\/\(\,\<\>\?]\s*\+", match) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: |
mNegN = re.search("[\:\=\+\-\*\/\(\,\<\>]\s*\-", match) | mNegN = re.search("[\:\=\+\-\*\/\(\,\<\>\?]\s*\-", match) mRetN = re.search("return\s+\-", line.stripped) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: |
if ( not (mSciN or mNegN or mOvrN or mEolN or mBolN or pointDeref)): | if ( not (mSciN or mNegN or mRetN or mOvrN or mEolN or mBolN or pointDeref)): | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: |
vList.append( Violation(self, line, "failed '[&|+-*/]='") ) | mOvr = re.search("operator[\&\|\*\+\-\/]?=\(", line.stripped) if not mOvr: vList.append( Violation(self, line, "failed '[&|+-*/]='") ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: |
self.inClass = False self.inStruct = False self.inPublic = False self.inProtected = False self.inPrivate = False self.className = "" self.structName = "" self.suppress = [] | self.inClass = False self.inStruct = False self.inPublic = False self.inProtected = False self.inPrivate = False self.inNestedClass = False self.inNestedStruct = False self.className = "" self.structName = "" self.suppress = [] | def __init__(self, raw, stripped): self.stripped = stripped self.raw = raw self.number = 0 self.variableNames = [] self.functionNames = [] self.templateNames = [] self.inClass = False self.inStruct = False self.inPublic = False self.inProtected = False self.inPrivate = False self.className = "" self.struc... |
inClass = False inStruct = False inPublic = False inProtected = False inPrivate = False | inClass = False inStruct = False inPublic = False inProtected = False inPrivate = False inNestedClass = False inNestedStruct = False | def flagLines(lines): inClass = False inStruct = False inPublic = False inProtected = False inPrivate = False nNested = 0 className = "" structName = "" for line in lines: # class information m = re.search("^\s*class\s+(\w+)\s*:?\s+", line.stripped) if m: className = m.group(1) inClass, inStruct, inPubl... |
if ((inClass or inStruct) and re.search("^\s*public:", line.stripped)): inPublic, inProtected, inPrivate = True, False, False if ((inClass or inStruct) and re.search("^\s*protected:", line.stripped)): inPublic, inProtected, inPrivate = False, True, False if ((inClass or inStruct) and re.search("^\s*private:", line.st... | if (inNestedClass and re.search("^};\s*", line.stripped)): inNestedClass = False if (inNestedStruct and re.search("^\};\s*", line.stripped)): inNestedStruct = False line.inClass = inClass line.inStruct = inStruct line.inPublic = inPublic line.inProtected = inProtected line.inPrivate = inPriv... | def flagLines(lines): inClass = False inStruct = False inPublic = False inProtected = False inPrivate = False nNested = 0 className = "" structName = "" for line in lines: # class information m = re.search("^\s*class\s+(\w+)\s*:?\s+", line.stripped) if m: className = m.group(1) inClass, inStruct, inPubl... |
mm = re.search("^\s+from ([^:]+.cc):(\d+):", raw_lines[iLine-2]) | mm = re.search("^In file included from ([^:]+.cc):(\d+):", raw_lines[iLine-2]) mm2 = re.search("^\s+from ([^:]+.cc):(\d+):", raw_lines[iLine-2]) | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
vList.append( Violation(self, line.number) ) | vList.append( Violation(self, line) ) | def apply(self, lines): vList = [] if ( self.getFiletype() in self.getTypeList() ): for line in lines: if ( re.search(self.regex, line.stripped) ): vList.append( Violation(self, line.number) ) return vList |
Test.__init__(self, 1, "typedef.*\s+([a-z]\w*);\s*$", "3-1", | Test.__init__(self, 1, "", "3-1", | def __init__(self, filetype): Test.__init__(self, 1, "typedef.*\s+([a-z]\w*);\s*$", "3-1", "User defined types must be mixed-case, starting with uppercase.", filetype, ["c", "cc", "h"]) |
iLine = line.number | iLine = line | def apply(self, lines): vList = [] for line in lines: iLine = line.number |
if (line.inPrivate): | if (line.inPrivate or line.inProtected): | def apply(self, lines): vList = [] for line in lines: iLine = line.number |
vList.append(Violation(self, line.number, "Starts uppercase")) | vList.append(Violation(self, line, "Starts uppercase")) | def apply(self, lines): vList = [] for line in lines: if (self.getFiletype() in self.getTypeList()): for functionName in line.functionNames: # check of upper case start if re.search("^[A-Z]", functionName): vList.append(Violation(self, line.number, "Starts uppercase")) # check for underscores hasUnderscore = re.search(... |
vList.append(Violation(self, line.number, "Contains underscore")) | vList.append(Violation(self, line, "Contains underscore")) | def apply(self, lines): vList = [] for line in lines: if (self.getFiletype() in self.getTypeList()): for functionName in line.functionNames: # check of upper case start if re.search("^[A-Z]", functionName): vList.append(Violation(self, line.number, "Starts uppercase")) # check for underscores hasUnderscore = re.search(... |
vList.append(Violation(self, line.number, "Contains non-leading underscore")) | vList.append(Violation(self, line, "Contains non-leading underscore")) | def apply(self, lines): vList = [] for line in lines: if (self.getFiletype() in self.getTypeList()): for functionName in line.functionNames: # check of upper case start if re.search("^[A-Z]", functionName): vList.append(Violation(self, line.number, "Starts uppercase")) # check for underscores hasUnderscore = re.search(... |
vList.append( Violation(self, line.number) ) | vList.append( Violation(self, line, name) ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: templateNameList = getTemplateNames(line.stripped) for name in templateNameList: if re.search("^[a-z]", name): vList.append( Violation(self, line.number) ) return vList |
vList.append( Violation(self, line.number, "\"" + variable + "\"") ) | vList.append( Violation(self, line, "\"" + variable + "\"") ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: for variable in line.variableNames: if (re.search("[A-Z]{2}", variable)): vList.append( Violation(self, line.number, "\"" + variable + "\"") ) return vList |
if ( re.search("^[^_]", tmp) and not (inParens1 or inParens2)): vList.append( Violation(self, line.number, variable) ) | inCommas = re.search(tmp + ".*,\s*$", line.stripped) isArg = inParens0 or inParens1 or inParens2 or inCommas if ( re.search("^[^_]", tmp) and not isArg): vList.append( Violation(self, line, variable) ) | def apply(self, lines): if (self.getFiletype() in self.getTypeList()): vList = [] for line in lines: if line.inPrivate: for variable in line.variableNames: tmp = re.sub("\s*[\*\&]\s*", "", variable) inParens1 = re.search("\([^\)]*" + tmp + "[^\)]*$", line.stripped) inParens2 = re.search("^[^\)]*" + tmp + "[^\)]*\)", li... |
vList.append(Violation(self, line.number, "Missing leading underscore")) | vList.append(Violation(self, line, "Missing leading underscore")) | def apply(self, lines): if (self.getFiletype() in self.getTypeList()): vList = [] for line in lines: if line.inPrivate: for variable in line.variableNames: tmp = re.sub("\s*[\*\&]\s*", "", variable) inParens1 = re.search("\([^\)]*" + tmp + "[^\)]*$", line.stripped) inParens2 = re.search("^[^\)]*" + tmp + "[^\)]*\)", li... |
vList.append( Violation(self, line.number) ) | vList.append( Violation(self, line) ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if line.inClass: for method in line.functionNames: if ( re.search(line.className.lower(), method.lower())): vList.append( Violation(self, line.number) ) return vList |
if ( not re.search("^(is|has)", variable) ): vList.append(Violation(self, line.number, variable)) | if ( line.inPrivate or line.inProtected ): if ( not re.search("^(_is|_has)", variable) ): vList.append(Violation(self, line, variable)) else: if ( not re.search("^(is|has)", variable) ): vList.append(Violation(self, line, variable)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: variableList = getVariableNames(line.stripped, "bool") for variable in variableList: if ( not re.search("^(is|has)", variable) ): vList.append(Violation(self, line.number, variable)) return vList |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: variableList = getVariableNames(line.stripped, "bool") for variable in variableList: if ( re.search("[nN]ot?", variable) ): vList.append(Violation(self, line.number)) return vList |
if ( not re.search("^//\s+-\*- LSST-C\+\+ -\*-", lines[0].raw) ): vList.append(Violation(self, 1)) | if ( not re.search("^//\s+-\*- (?:LSST-C|lsst-c)\+\+ -\*-", lines[0].raw) ): vList.append(Violation(self, lines[0])) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): if ( not re.search("^//\s+-\*- LSST-C\+\+ -\*-", lines[0].raw) ): vList.append(Violation(self, 1)) return vList |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): classNames = [] for line in lines: if (line.inClass and (not line.className in classNames)): classNames.append(line.className) |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: definitionLength = getDefinitionLength(lines, line.number) isTooLong = (definitionLength > 1) isTemplatized = re.search("^\s*template", lines[line.number - 2].stripped) if ( len(line.functionNames) > 0 and not isTempla... |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if ( re.search("inline", line.stripped) ): definitionLength = getDefinitionLength(lines, line.number) isTooLong = (definitionLength > 1) |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if ( re.search("^.{111,}$", line.raw) ): vList.append(Violation(self, line.number)) return vList |
vList.append(Violation(self, line.number, "contains \\t")) | vList.append(Violation(self, line, "contains \\t")) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if ( re.search("\t", line.stripped)): vList.append(Violation(self, line.number, "contains \\t")) if ( re.search("\r", line.stripped)): vList.append(Violation(self, line.number, "contains \\r")) if ( re.search("\f", line... |
vList.append(Violation(self, line.number, "contains \\r")) | vList.append(Violation(self, line, "contains \\r")) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if ( re.search("\t", line.stripped)): vList.append(Violation(self, line.number, "contains \\t")) if ( re.search("\r", line.stripped)): vList.append(Violation(self, line.number, "contains \\r")) if ( re.search("\f", line... |
vList.append(Violation(self, line.number, "contains \\f")) | vList.append(Violation(self, line, "contains \\f")) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if ( re.search("\t", line.stripped)): vList.append(Violation(self, line.number, "contains \\t")) if ( re.search("\r", line.stripped)): vList.append(Violation(self, line.number, "contains \\r")) if ( re.search("\f", line... |
vList.append(Violation(self, 2)) | vList.append(Violation(self, lines[1])) | m2 = re.search("^\#ifndef (LSST_[A-Z_]+_H)\s*$", lines[1].stripped) |
vList.append(Violation(self, 3)) | vList.append(Violation(self, lines[2])) | m2 = re.search("^\#ifndef (LSST_[A-Z_]+_H)\s*$", lines[1].stripped) |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): # angle bracket style #include<foo> should preceed quote style #include "foo.h" foundQuoteStyle = False for line in lines: if ( re.search("^\#include\s+\"\w+\.h(pp)?\"\s*$", line.stripped) ): foundQuoteStyle = True if ( foundQuoteStyle an... |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] |
vList.append( Violation(self, line.number, "'public' repeated") ) | vList.append( Violation(self, line, "'public' repeated") ) | def apply(self, lines): if (self.getFiletype() in self.getTypeList()): vList = [] order = [0, 0, 0] nSeg = 0 for line in lines: if (re.search("^\s*public:", line.stripped) and line.inClass): if order[0]: vList.append( Violation(self, line.number, "'public' repeated") ) nSeg += 1 order[0] = nSeg if (re.search("^\s*prot... |
vList.append( Violation(self, line.number, "'protected' repeated") ) | vList.append( Violation(self, line, "'protected' repeated") ) | def apply(self, lines): if (self.getFiletype() in self.getTypeList()): vList = [] order = [0, 0, 0] nSeg = 0 for line in lines: if (re.search("^\s*public:", line.stripped) and line.inClass): if order[0]: vList.append( Violation(self, line.number, "'public' repeated") ) nSeg += 1 order[0] = nSeg if (re.search("^\s*prot... |
vList.append( Violation(self, line.number, "'private' repeated") ) | vList.append( Violation(self, line, "'private' repeated") ) | def apply(self, lines): if (self.getFiletype() in self.getTypeList()): vList = [] order = [0, 0, 0] nSeg = 0 for line in lines: if (re.search("^\s*public:", line.stripped) and line.inClass): if order[0]: vList.append( Violation(self, line.number, "'public' repeated") ) nSeg += 1 order[0] = nSeg if (re.search("^\s*prot... |
vList.append( Violation(self, line.number, msg) ) | vList.append( Violation(self, line, msg) ) | def apply(self, lines): if (self.getFiletype() in self.getTypeList()): vList = [] order = [0, 0, 0] nSeg = 0 for line in lines: if (re.search("^\s*public:", line.stripped) and line.inClass): if order[0]: vList.append( Violation(self, line.number, "'public' repeated") ) nSeg += 1 order[0] = nSeg if (re.search("^\s*prot... |
if (len(line.variableNames) > 0 and not re.search("(const|static)", line.stripped)): vList.append(Violation(self, line.number)) | if (len(line.variableNames) > 0): isArgument = re.search("\([^\)]+" + ".*".join(line.variableNames) + "[^\(]+\)", line.stripped) isConstStatic = re.search("(const|static)", line.stripped) if (len(line.variableNames) > 0 and not isConstStatic and not isArgument): vList.append(Violation(self, line, "variables: " + ", ".... | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: # nNested counts how many blocks are nested ... greater than 1 is a variable in a function if (line.inPublic and line.nNested == 1): if (len(line.variableNames) > 0 and not re.search("(const|static)", line.stripped)): v... |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): stypes = getPrimitivesOr() + "|[A-Z]\w+" for line in lines: for variable in line.variableNames: variable = re.sub("\*", "\\*", variable) # pointers variable = re.sub("\&", "\\&", variable) # refs regex = "const\s+(" + stypes + ")\s+" + va... |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if ( re.search("^\s*for\s*\(([^;]+);([^;]+);([^;]+)\)", line.stripped) and re.search(",", line.stripped) ): vList.append(Violation(self, line.number)) return vList |
vList.append(Violation(self, line.number, "used 'break'")) | vList.append(Violation(self, line, "used 'break'")) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): inSwitch = False nNested = 0 for line in lines: if (re.search("^\s*switch", line.stripped)): inSwitch = True nNested = 0 if (re.search("\{", line.stripped)): nNested += 1 if (re.search("\}", line.stripped)): nNested -= 1 if (re.search("... |
vList.append(Violation(self, line.number, "used 'continue'")) | vList.append(Violation(self, line, "used 'continue'")) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): inSwitch = False nNested = 0 for line in lines: if (re.search("^\s*switch", line.stripped)): inSwitch = True nNested = 0 if (re.search("\{", line.stripped)): nNested += 1 if (re.search("\}", line.stripped)): nNested -= 1 if (re.search("... |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): primitives = getPrimitives() inParentheses = False for line in lines: declarations = [] if (line.functionNames): inParentheses = True if (inParentheses): |
name = m.group(1) | name = re.sub(r"([\&\[\]])", r'\\\1', m.group(1)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if line.inPublic: # if it's only 1 arg, it should fit on one line ... there will be exceptions m = re.search("^\s*([^\(]+)\s*\([^\),]+\s[^\),]+\)", line.stripped) if m: name = m.group(1) if (re.search(name, line.classNa... |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if line.inPublic: # if it's only 1 arg, it should fit on one line ... there will be exceptions m = re.search("^\s*([^\(]+)\s*\([^\),]+\s[^\),]+\)", line.stripped) if m: name = m.group(1) if (re.search(name, line.classNa... |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): inDestructor = False nNested = 0 for line in lines: if (re.search("^\s*((?:\s*virtual\s*)\~|\w+::\~)", line.stripped)): inDestructor = True nNested = 0 if (re.search("\{", line.stripped)): nNested += 1 if (re.search("\}", line.stripped)... |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: # virtual declaration is only in the class definition isDestructor = re.search("^\s*\~", line.stripped) isBaseClass = line.inClass and re.search("Base$", line.className) isVirtual = re.search("^\s*virtual", line.strippe... |
vList.append( Violation(self, line.number) ) | vList.append( Violation(self, line) ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: # allow char * for argv[] if (re.search("char\s*(const\s*)?\*", line.stripped) and not re.search("^int main", line.stripped)): vList.append( Violation(self, line.number) ) return vList |
vList.append( Violation(self, line.number) ) | vList.append( Violation(self, line) ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: for variable in line.variableNames: if (re.search("\[[^\]]+\]", variable) ): vList.append( Violation(self, line.number) ) return vList |
vList.append( Violation(self, line.number) ) | vList.append( Violation(self, line) ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if ( re.search("^\s*using", line.stripped) and not re.search("\s*std\s*;\s*$", line.stripped) ): vList.append( Violation(self, line.number) ) return vList |
vList.append( Violation(self, line.number) ) | vList.append( Violation(self, line) ) | def apply(self, lines): vList = [] # don't enforce this for line continuation of argument lists or other parenthesized statements inParentheses = False if (self.getFiletype() in self.getTypeList()): for line in lines: if (re.search("\([^\)]+$", line.stripped)): inParentheses = True m = re.search("^(\s*)[^\s]", line.s... |
vList.append( Violation(self, line.number) ) | vList.append( Violation(self, line) ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: # a lone '{' is non-KR style, unless the previous line is blank # ... then it's ok as it denotes a block-scope if (re.search("^\s*\{", line.stripped) and re.search("[^\s]+", lines[line.number - 2].stripped) ): vList.ap... |
vList.append( Violation(self, line.number) ) | vList.append( Violation(self, line) ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if (re.search("\{\s*$", line.stripped) and re.search("^\s*\}\s*$", lines[line.number].stripped) ): vList.append( Violation(self, line.number) ) return vList |
vList.append(Violation(self, line.number, "failed '='")) | isDefault = False if line.variableNames > 0: isDefaultSameLine = re.search("\([^\)]*([^=]=[^=])+[^\(]*\)", line.stripped) isDefaultDiffLine = re.search("[\d\w]=[\d\w]+(?:\<\w+\>)?(?:\(.*\))?,", line.stripped) isDefault = isDefaultSameLine or isDefaultDiffLine if not isDefault: vList.append(Violation(self, line, "failed... | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: |
vList.append( Violation(self, line.number, "failed '+'") ) | vList.append( Violation(self, line, "failed '+'") ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: |
vList.append( Violation(self, line.number, "failed '-'") ) | vList.append( Violation(self, line, "failed '-'") ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: |
vList.append( Violation(self, line.number, "failed '[&|+-*/]='") ) | vList.append( Violation(self, line, "failed '[&|+-*/]='") ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: |
vList.append( Violation(self, line.number, "after comma") ) | vList.append( Violation(self, line, "after comma") ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: # careful, comma followed by \n is ok. if ( re.search(",[^\s]", line.stripped) and not re.search(",\s*$", line.stripped) ): vList.append( Violation(self, line.number, "after comma") ) m = re.search("^\s*(for|if|while|el... |
vList.append( Violation(self, line.number, "after reserved word '" + rword + "'") ) | vList.append( Violation(self, line, "after reserved word '" + rword + "'") ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: # careful, comma followed by \n is ok. if ( re.search(",[^\s]", line.stripped) and not re.search(",\s*$", line.stripped) ): vList.append( Violation(self, line.number, "after comma") ) m = re.search("^\s*(for|if|while|el... |
vList.append( Violation(self, line.number, "after semi-colon") ) | vList.append( Violation(self, line, "after semi-colon") ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: # careful, comma followed by \n is ok. if ( re.search(",[^\s]", line.stripped) and not re.search(",\s*$", line.stripped) ): vList.append( Violation(self, line.number, "after comma") ) m = re.search("^\s*(for|if|while|el... |
vList.append( Violation(self, line.number) ) | vList.append( Violation(self, line) ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if ( re.search("namespace.*namespace", line.stripped) ): vList.append( Violation(self, line.number) ) if ( re.search("^\s+namespace", line.stripped) ): vList.append( Violation(self, line.number) ) return vList |
vList.append( Violation(self, line.number) ) | vList.append( Violation(self, line) ) | def apply(self, lines): vList = [] if (self.getFiletype() in self.getTypeList()): for line in lines: if ( re.search(Test.getRegex(self), line.stripped) ): vList.append( Violation(self, line.number) ) return vList |
def __init__(self, test, lineNumber, extraComment = ""): | def __init__(self, test, line, extraComment = ""): | def __init__(self, test, lineNumber, extraComment = ""): self.test = test self.lineNumber = lineNumber self.extraComment = extraComment |
self.lineNumber = lineNumber | self.line = line self.lineNumber = line.number | def __init__(self, test, lineNumber, extraComment = ""): self.test = test self.lineNumber = lineNumber self.extraComment = extraComment |
self.suppress = [] | def __init__(self, raw, stripped): self.stripped = stripped self.raw = raw self.number = 0 self.variableNames = [] self.functionNames = [] self.templateNames = [] self.inClass = False self.inStruct = False self.inPublic = False self.inProtected = False self.inPrivate = False self.className = "" self.struc... | |
variable = re.sub("\([^\)]+\)", "", variable) variableList.append(variable.strip()) | variable = re.sub("\([^\)]*\)", "", variable) regex = "\<[^\>]*" + variable + "[^\<]*\>" mm = re.search(regex, originalLine) if not mm: variableList.append(variable.strip()) | def getVariableNames(line, stypes = getPrimitivesOr() + "|" + getUserTypeRegex()): # clear out 'const', 'static', and some whitespace ... makes the regex matching easier # kill possible 'const = 0' as that denote a virtual function line = re.sub("const(\s*=\s*0)?", "", line) line = re.sub("static", "", line) line = re... |
templateNames = re.sub(",?\s*(typename|class)", "", templateString) | templateNames = re.sub(",?\s*(typename|class|bool|float|double|int|unsigned int)", "", templateString) | def getTemplateNames(line): templateNameList = [] m = re.search("^\s*template<(.*?)>\s*$", line) if m: templateString = m.group(1) templateNames = re.sub(",?\s*(typename|class)", "", templateString) templateNameList += templateNames.split() return templateNameList |
violationSort = sorted(violationList, key = lambda x: x.getLineNumber()); if violationSort: | violationFinal = [] violationSort = sorted(violationList, key = lambda x: x.getLineNumber()) for violation in violationSort: parasoftSuppress = "LsstDm-" + violation.getId() in violation.line.suppress if not parasoftSuppress: violationFinal.append(violation) if violationFinal: | def main(): ######################################################################## # command line arguments and options ######################################################################## parser = optparse.OptionParser(usage = __doc__) parser.add_option("-i", "--ignore", dest = "ignore", default = ".ignore-styl... |
for violation in violationSort: | for violation in violationFinal: | def main(): ######################################################################## # command line arguments and options ######################################################################## parser = optparse.OptionParser(usage = __doc__) parser.add_option("-i", "--ignore", dest = "ignore", default = ".ignore-styl... |
if re.search("^g\+\+", line): | if re.search("^g\+\+", raw_line): | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
compile_lines[srcFile] = line.strip() | compile_lines[srcFile] = raw_line.strip() srcFileLookup[srcFile] = srcFile | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
line = re.sub("\s+-([DILl]|Wl,)\S+", "", line) | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... | |
srcFileLookup[srcFile] = errFile | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... | |
mm2 = re.search("^\s+from ([^:]+.cc):(\d+):", raw_lines[iLine-2]) | mm2 = False maxLines = 2 iL = 0 while (not mm2 and iL < maxLines): mm2 = re.search("^\s+from ([^:]+.cc):(\d+):", raw_lines[iLine-2-iL]) iL += 1 | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
print " | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... | |
out = re.sub(pattern, colorPattern, line) | if re.search("^\d+$", pattern): out = re.sub(":"+pattern, ":"+colorPattern, line) else: out = re.sub(pattern, colorPattern, line) | def regexColorReplace(regex, clrs, line): m = re.search(regex, line) out = line if (m): pattern = m.group(1) colorPattern = "" # note clrs is a list, this way colors and styles can be included together (ie. ["red", "bold"] for clr in clrs: colorPattern += color(clr) colorPattern += pattern + color("reset") out = re.sub... |
line = regexColorReplace(r'\/?(\w+\.(?:cc|h|i|hpp)):\d+', ["cyan"], line) | line = regexColorReplace(r'\/?(\w+\.(?:cc|h|i|hpp)):\d+[,:]', ["cyan"], line) | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
line = regexColorReplace(r':(\d+)', ["magenta"], line) | line = regexColorReplace(':(\d+)[,:]', ["magenta"], line) | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
def main(log, retryscript): | def main(filedesc, log, retryscript): | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
line = sys.stdin.readline() | line = filedesc.readline() | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
print " srcFile = srcFileLookup[errFile] if not already_compiling.has_key(srcFile): compile_line = compile_lines[srcFile] already_compiling[srcFile] = 1 if len(s) == 0: s += " s += "echo \"" + compile_line + "\"\n" s += compile_line + "\n" | else: maxCheck = 8 iCheck = 0 while (iCheck < maxCheck): if len(srcFileList) < iCheck: break srcFile = srcFileList[-iCheck] srcPattern = re.sub(".cc$", "", srcFile) possibleObjFiles = glob.glob(srcPattern+".*") possibleObjFiles = filter(lambda x: re.search(".(o|os|so)$", x), possibleObjFiles) if len(possibleObjFiles... | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
main(opts.log, opts.retryscript) | main(sys.stdin, opts.log, opts.retryscript) | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
compile_lines = {} | compile_lines = {} srcFileLookup = {} | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
already_compiling = {} | already_compiling = {} raw_lines = [] iLine = 0 | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
srcFile = m.groups()[0] | errFile = m.groups()[0] srcFileLookup[srcFile] = errFile if re.search("\.h$", errFile): mm = re.search("^\s+from ([^:]+.cc):(\d+):", raw_lines[iLine-2]) if mm: srcFileLookup[errFile] = mm.groups()[0] | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
if re.search("\.h$", srcFile): mm = re.search("In file included from ([^:]+):(\d+):", prev_line) if mm: srcFile = mm.groups()[0] | srcFile = srcFileLookup[errFile] | def main(log, retryscript): if log: fp_log = open("noI.log", 'w') #################################### # loop over stdin lines #################################### # have the retry script echo a message if there are no errors no_op_mesg = "No errors were found in the most recent scons compile." s = "#!/usr/bin/env b... |
elif func is os.makedirs: | elif func is mkdir: | def __str__(self): func = self.func args = self.args |
yield self.Action(os.makedirs, change.path) | yield self.Action(mkdir, change.path) | def emptydirs(self): for change in self: if not lexists(change.path) and change.OP == 's': yield self.Action(os.makedirs, change.path) |
if not table: | if not database or not table: | def match_name(sql): sql = re.sub(r'/\*.*?\*/', "", sql) name = sql.split()[2] return re.sub(r'`(.*)`', '\\1', name) |
product = "{ProductToken}" + product user = "{UserToken}" + user | def fmt_s3_headers(product, user): product = "{ProductToken}" + product user = "{UserToken}" + user return "x-amz-security-token=" + ",".join([product,user]) | |
except rollback.Error: | except Rollback.Error: | def main(): try: opts, args = getopt.gnu_getopt(sys.argv[1:], 'h', ['help']) except getopt.GetoptError, e: usage(e) for opt, val in opts: if opt in ('-h', '--help'): usage() if args: usage() try: rollback = Rollback() except rollback.Error: fatal("nothing to rollback") rollback.rollback() |
return False | return self.default | def is_included(self, path): while path not in ('', '/'): if path in self: return self[path] path = dirname(path) |
backup_id = uri.strip("/").split("/")[-1] | backup_id = url.strip("/").split("/")[-1] | def api(method, url, attrs={}, headers=[]): c = Curl(url, headers) func = getattr(c, method.lower()) func(attrs) if not c.response_code == 200: if c.response_data.splitlines()[1] == "BackupAccount not subscribed": raise NotSubscribedError("user not subscribed to Backups") if c.response_data.splitlines()[1] == "Backu... |
os.environ['PASSPHRASE'] = file(self.secretfile).readline().strip() | os.environ['PASSPHRASE'] = file(self.conf.secretfile).readline().strip() | def run(self): os.environ['PASSPHRASE'] = file(self.secretfile).readline().strip() exitcode = os.system(self.command) del os.environ['PASSPHRASE'] |
opts, args = getopt.gnu_getopt(sys.argv[1:], 'u:g:sh', ['uid-map=', 'gid-map=', 'simulate']) | opts, args = getopt.gnu_getopt(sys.argv[1:], 'u:g:svh', ['uid-map=', 'gid-map=', 'simulate', 'verbose']) | def main(): try: opts, args = getopt.gnu_getopt(sys.argv[1:], 'u:g:sh', ['uid-map=', 'gid-map=', 'simulate']) except getopt.GetoptError, e: usage(e) simulate = False uidmap = IdMap() gidmap = IdMap() for opt, val in opts: if opt in ('-u', '--uid-map'): uidmap = IdMap.fromline(val) elif opt in ('-g', '--gid-map'): gid... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.