Showing 133 of 166 total issues
Function findSubject
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def findSubject(line,inFileName):
match = re.search(SUBJECTPATTERN1+r" *(.*)",line)
if match: subject = match.group(1)
else:
match = re.search(SUBJECTPATTERN2+r" *(.*)",line)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function printResults
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def printResults(features,results):
for i in range(0,len(METADATAFEATURES)):
if i != 0: print(",",end="")
if METADATAFEATURES[i] in results:
print(removeSpaces(str(results[METADATAFEATURES[i]])),end="")
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function sentenceSplitLocal
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def sentenceSplitLocal(text):
tokens = text.split()
sentence = []
sentences = []
for token in tokens:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function makePlotDatesPart
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def makePlotDatesPart(fieldDataList,fieldNames,format,barwidth,dates,senders,target):
Function visualizeDAAP
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def visualizeDAAP(file,user="",mail=-1,average=False,linemax=LINEMAX,equalwidth=False,table=False):
Function makePlotDAAP
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def makePlotDAAP(fileName,data,index=-1,user="",average=False,linemax=LINEMAX,equalwidth=False):
Function combineData
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def combineData(emails,sender,start,end,setSize,getLast=False):
Avoid deeply nested control flow statements. Open
if element.tag == DATE: data[DATE] = cleanupText(element.text)
elif element.tag == TIME: data[TIME] = cleanupText(element.text)
elif element.tag == URGE: data[URGE] = cleanupText(element.text)
elif element.tag == STANDARDUNITS: data[STANDARDUNITS] = cleanupText(element.text)
elif element.tag == MEASUREMENTUNITNAME: data[MEASUREMENTUNITNAME] = cleanupText(element.text)
Avoid deeply nested control flow statements. Open
if featureName in summary:
summary[featureName] += 1
else:
summary[featureName] = 1
return(summary)
Avoid deeply nested control flow statements. Open
if numbers != None and len(numbers) > 0:
questionNumber = cleanupText(numbers[0].text)
else:
questionNumber = str(int(questionNumber)+1)
for elementQ in question:
Function makePlotDates
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def makePlotDates(fieldDataList,fieldNames,format,barwidth,dates,senders):
Function findDuplicateColumns
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def findDuplicateColumns(columnNames):
duplicateColumns = REQUESTED
for columnName in columnNames:
shortName = re.sub(r"..$",r"",columnName)
if shortName in columnNames and not columnName in EXCEPTIONS:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if not sentenceInitial:
text += "\n"
sentenceInitial = True
lastPOS = ""
else:
Avoid deeply nested control flow statements. Open
if numbers != None and len(numbers) > 0:
number = cleanupText(numbers[0].text)
else:
number = str(int(number)+1)
for answer in question.findall(ANSWERS):
Avoid deeply nested control flow statements. Open
for columnName in sortKeys(columns.keys()):
try: row.append(countsFilter(questionnaire[columnName],title))
except: row.append(EMPTYTOKEN)
csvwriter.writerow(row)
Avoid deeply nested control flow statements. Open
for elementQ in question:
if elementQ.tag == TITLE:
questionTitle = cleanupText(elementQ.text)
if elementQ.tag == QUESTIONNUMBER:
questionNumber = cleanupText(elementQ.text)
Avoid deeply nested control flow statements. Open
for columnName in sorted(columns.keys()):
try: row.append(questionnaire[columnName])
except: row.append("")
csvwriter.writerow(row)
Function visualize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def visualize(file,features,format="",barwidth=BARWIDTH,target=CLIENT,diaries=True):
Function main
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def main(argv):
options,files,names = processOptions(argv)
if "-p" in options: processedText = readPosFile(options["-p"])
elif "-t" in options: processedText = processTextWithFrog(options["-t"])
else: sys.exit(USAGE)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if featureName in summary:
summary[featureName] += int(row[featureName])
else:
summary[featureName] = int(row[featureName])
else: