Showing 133 of 166 total issues
Function main
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
def main(argv):
inFileName = argv.pop(1)
inFile = gzip.open(inFileName,"rb")
inFileContent = inFile.read()
inFile.close()
- 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 egofy
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
def egofy(processedText,names,gender):
text = ""
textInitial = True
for paragraph in processedText:
sentenceInitial = True
- 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 getQuestionnaires
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def getQuestionnaires(root,thisId):
global exceptions
qs = []
number = "0"
for questionnaires in INTAKEQUESTIONNAIRE,QUESTIONNAIRE:
- 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
File tactusVisualize.py
has 405 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
"""
tactus-visualize.py: support functions for tactus-visualize.ipynb
usage: import tactus-visualize
20190108 erikt(at)xs4all.nl
Consider simplifying this complex logical expression. Open
if token in names and names[token] == COMPLETE:
if re.search(r"VZ",lastPOS):
text += METOKEN[sentenceInitial]+" "
else:
text += ITOKEN[sentenceInitial]+" "
Function makeTableDAAP
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def makeTableDAAP(fileName,data,index=-1,user="",average=False):
if user == "CLIENT" or user == "COUNSELOR":
values = [ x for x in data if x[SENDER] == user ]
else:
values = [ x for x in data if x[MAILID] == index ]
- 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 cleanupMails
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def cleanupMails(clientMails, counselorMails):
clientSentenceDates = {}
counselorSentenceDates = {}
for i in range(0,len(clientMails)):
date = clientMails[i][MAILDATEID]
- 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 processFile
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def processFile(client,counselor,lines,options):
date = ""
mailText = ""
nbrOfProcessed = 0
receiver = ""
- 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 anonymize
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def anonymize(tokens,pos,ner,options):
global names
if not isEmailHead(tokens):
for i in range(0,len(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 visualizeDAAP
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def visualizeDAAP(file,user="",mail=-1,average=False,linemax=LINEMAX,equalwidth=False,table=False):
data = readData(file)
if len(data) == 0: sys.exit("no data found!")
if table:
if user == CLIENT or user == COUNSELOR:
- 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
File tactus2liwc-nl.py
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/python3
"""
tactus2liwc-nl.py: convert xml files from tactus to percentages of liwc categories
usage: tactus2liwc-nl.py file1 [file2 ...]
note: based on tactus2text.py, tactus2liwc-en.py and text2liwc.py
File tactus2liwc-en.py
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/python3
"""
tactus2liwc-en.py: convert xml files from tactus to liwc scores per mail csv
usage: tactus2liwc-en.py file1.xml [file2.xml ...] > file1.csv
note: based on tactus2table.py and text2liwc.py
Function summarizeData
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def summarizeData(data,target):
summary = {}
for row in data:
if target == None or row[SENDER] == target:
for featureName in row:
- 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 makePlotDAAP
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def makePlotDAAP(fileName,data,index=-1,user="",average=False,linemax=LINEMAX,equalwidth=False):
plt.figure(figsize=(PLOTWIDTH,PLOTHEIGHT))
if user == "CLIENT" or user == "COUNSELOR":
values = [ x for x in data if x[SENDER] == user ]
else:
- 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 anonymize
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def anonymize(tokens,pos,ner,interactive):
global positiveNames,negativeNames
if len(tokens) > 1 and tokens[0] in SKIP and tokens[1] == ":":
return(" ".join(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 computeStats
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def computeStats(data):
stats = { CLIENT:{AVERAGE:0.0,COUNT:0,MAX:-1.0,MIN:1.0,SD:0.0,TOTAL:0.0,TOTALDEV:0.0},
COUNSELOR:{AVERAGE:0.0,COUNT:0,MAX:-1.0,MIN:1.0,SD:0.0,TOTAL:0.0,TOTALDEV:0.0} }
for d in data:
if SENDER in d and d[SENDER] in stats:
- 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 compressNE
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def compressNE(tokens):
i = 0
while i >= 0 and i < len(tokens):
removedTokens = 0
if tokens[i] in NETAGS:
- 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 20 (exceeds 5 allowed). Consider refactoring. Open
def printResults(annotatedText):
paragraphs = annotatedText.split("\n")
for par in paragraphs:
par = addMissingSpaces(par)
tokens = par.split(" ")
- 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
File egofy.py
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
"""
egofy.py: change Dutch biographic text to autobiographic text
usage: egofy.py [-t file.txt ] [-p file.txt.pos] [-n name] [-s]
notes:
Function cleanupMails
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def cleanupMails(clientMails, counselorMails):
clientSentenceDates = {}
counselorSentenceDates = {}
for i in range(0,len(clientMails)):
date = clientMails[i][MAILDATEID]
- 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"