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 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
Consider simplifying this complex logical expression. Open
if tokens[i] in [MONTH,DATE,DAY]:
if i < len(tokens)-1 and tokens[i+1] in [NUM,MONTH,DATE,DAY]:
removeFromList(tokens,i+1)
removedTokens += 1
tokens[i] = DATE
Function readSentence
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def readSentence():
tokens,pos,ner = [[],[],[]]
for line in sys.stdin:
try:
line = line.rstrip()
- 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
Consider simplifying this complex logical expression. Open
if tokens[i] in names.keys():
if names[tokens[i]] != NEOTHER:
tokens[i] = names[tokens[i]]
elif pos[i] == TAGNUM or re.search(r"^\d",tokens[i]) or re.search(r"^-\d",tokens[i]):
tokens[i] = NUM
Function processOptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def processOptions(argv):
try:
optionList, files = getopt.getopt(argv,"ln",[])
options = {}
for option, arg in optionList:
- 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"