e-mental-health/data-processing

View on GitHub
tactus2daap-en.py

Summary

Maintainability
C
1 day
Test Coverage

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]
Severity: Minor
Found in tactus2daap-en.py - About 2 hrs 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

File tactus2daap-en.py has 263 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/python3
"""
    tactus2daap-en.py: convert xml files from tactus to daap scores per mail csv
    usage: tactus2daap-en.py [-m] file1.xml [file2.xml ...] > file1.csv
    notes: 
Severity: Minor
Found in tactus2daap-en.py - About 2 hrs to fix

    Function getQuestionnaires has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def getQuestionnaires(root,thisId):
        qs = []
        for questionnaires in INTAKEQUESTIONNAIRE,QUESTIONNAIRE:
            for questionnaire in root.findall(questionnaires):
                title = cleanupText(questionnaire.findall("./Title")[0].text)
    Severity: Minor
    Found in tactus2daap-en.py - About 1 hr 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 getEmailData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def getEmailData(root,thisId):
        clientMails = []
        counselorMails = []
        for message in root.findall(MESSAGES):
            body = ""
    Severity: Minor
    Found in tactus2daap-en.py - About 1 hr 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 text2daap has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def text2daap(words,tokens):
        global numberId
    
        counts = { NBROFMATCHES:0 , DAAPAVG:0.0, DAAPPOS:0.0, DAAPNEG:0.0 }
        for token in tokens:
    Severity: Minor
    Found in tactus2daap-en.py - About 1 hr 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 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="")
    Severity: Minor
    Found in tactus2daap-en.py - About 55 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

    There are no issues that match your filters.

    Category
    Status