e-mental-health/data-processing

View on GitHub

Showing 133 of 166 total issues

Function summarizeDataEnd has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def summarizeDataEnd(countedElements,countedGroups):
    counter = 0
    nbrOfElements = 0
    nbrOfGroups = 0
    if len(countedElements) >= 2*SUMMARYCOUNT:
Severity: Minor
Found in computeAveragesPerPerson.py - About 25 mins to fix

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 getColumns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def getColumns(questionnaires,title):
    columns = {}
    for questionnaire in questionnaires:
        if questionnaire["0-title"] == title:
            for field in questionnaire.keys():
Severity: Minor
Found in tactus2table.py - About 25 mins to fix

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 updateMailTexts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def updateMailTexts(tree,tagNames,processedList):
    root = tree.getroot()
    i = 0
    for tag in root.iter():
        if not tag.text is None:
Severity: Minor
Found in tactus-anonymize.py - About 25 mins to fix

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 matchTokenToNames has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def matchTokenToNames(paragraph,start,names):
    if not paragraph[start][TOKEN] in names: return(paragraph[start][TOKEN],start,start)
    end = start
    token = paragraph[start][TOKEN]
    while end+1 < len(paragraph) and token+" "+paragraph[end+1][TOKEN] in names:
Severity: Minor
Found in egofy.py - About 25 mins to fix

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 anonymizeCounselor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def anonymizeCounselor(name):
    global counselorIds;

    if not name in counselorIds.keys(): 
        thisId = random.randrange(COUNSELORIDMIN,COUNSELORIDMAX)
Severity: Minor
Found in ovk2table.py - About 25 mins to fix

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 printFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def printFields(fields,options):
    if not fields[0] in ENTITYLABELS: fields[0] = "O"
    elif UNLOPTION in options: fields[0] = UNLABELED
    else: fields[0] = "B-"+fields[0]
    if not fields[-1] in ENTITYLABELS: fields[-1] = "O"
Severity: Minor
Found in prepare-eval.py - About 25 mins to fix

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 getDateAlpha has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def getDateAlpha(line):
    try:
        matchDateAlpha = re.search(DATEPATTERNALPHA,line)
        if not matchDateAlpha: date = ""
        else:
Severity: Minor
Found in ovkPrepare.py - About 25 mins to fix

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 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:
Severity: Minor
Found in anonymize-ovk.py - About 25 mins to fix

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 getColumns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def getColumns(questionnaires,title):
    columns = {}
    for questionnaire in questionnaires:
        if questionnaire["title"] == title:
            for field in questionnaire.keys():
Severity: Minor
Found in tactus2liwc-nl.py - About 25 mins to fix

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 getChildText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def getChildText(tag,childName):
    childText = ""
    for child in tag.findall("./"+childName):
        try:
            if childText == "": childText = normalizeWhiteSpace(child.text)
Severity: Minor
Found in tactus-anonymize.py - About 25 mins to fix

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 readPosFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def readPosFile(inFileName):
    try: inFile = open(inFileName,"r")
    except Exception as e: sys.exit(COMMAND+": cannot read from file "+inFileName)
    paragraph,processedText = [],[]
    for line in inFile:
Severity: Minor
Found in egofy.py - About 25 mins to fix

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 getFieldTotal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def getFieldTotal(row,prefix,suffix,convertor,maxIndex,addZero):
    total = 0
    NAcount = 0
    for i in range(1,maxIndex+1):
        fieldName = makeFieldName(prefix,suffix,i,addZero)
Severity: Minor
Found in extractMetaData.py - About 25 mins to fix

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 getTextFromXmlText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def getTextFromXmlText(text):
    try: textTree = ET.fromstring("<container>"+text+"</container>")
    except Exception as e: sys.exit("Error processing text "+text+": "+str(e))
    if not textTree.text is None: text = textTree.text
    else: text = ""
Severity: Minor
Found in tactus-anonymize.py - About 25 mins to fix

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

Severity
Category
Status
Source
Language