e-mental-health/data-processing

View on GitHub

Showing 133 of 166 total issues

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

Function nameMatch has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def nameMatch(targetNames,sourceNames,suffix=""):
    for targetName in targetNames:
        for sourceName in sourceNames:
            targetName = targetName.lower()
            sourceName = sourceName.lower()
Severity: Minor
Found in egofy.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

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 tactus2liwc-nl.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 tactus2table.py has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/python3
"""
    tactus2table.py: convert xml files from tactus to csv tables
    usage: tactus2table.py file1 [file2 ...]
    note: writes output to ../output/emails.csv
Severity: Minor
Found in tactus2table.py - About 2 hrs to fix

    Function main has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def main(argv):
        csvreader = csv.DictReader(sys.stdin,delimiter=SEPARATOR)
        fieldNames = makeNewFieldNames(csvreader.fieldnames)
        csvwriter = csv.DictWriter(sys.stdout,delimiter=SEPARATOR,fieldnames=fieldNames)
        csvwriter.writeheader()
    Severity: Minor
    Found in table2wide.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

    Function findDate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def findDate(line,inFileName):
        match = re.search(r"([0-9]+)-([0-9]+)-([0-9]+)(\s+([0-9]+):([0-9]+)(:([0-9]+))?)?",line)
        if not match: 
            sys.exit(COMMAND+": error: no date in file "+inFileName+" on line: "+line)
        else:
    Severity: Minor
    Found in ovk2table.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 storeDictTitles has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def storeDictTitles(questionnaires):
          titles = getTitles(questionnaires)
          for title in titles.keys():
              columns = getColumns(questionnaires,title)
              outFileName = OUTPUTDIR+"/"+title+".csv"
      Severity: Minor
      Found in tactus2liwc-nl.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

      Function storeDictTitles has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def storeDictTitles(questionnaires):
          titles = getTitles(questionnaires)
          for title in titles.keys():
              columns = getColumns(questionnaires,title)
              outFileName = OUTPUTDIR+"/"+title+".csv"
      Severity: Minor
      Found in tactus2table.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

      Function main has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def main(argv):
          with sys.stdout as csvFile:
              csvWriter = csv.DictWriter(csvFile,fieldnames=FIELDNAMES)
              csvWriter.writeheader()
              for inFileName in argv[1:]:
      Severity: Minor
      Found in wordCount.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

      Function convertToAverages has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def convertToAverages(valuesIn,equalwidth=False):
          startI = 0
          startId = int(valuesIn[0][MAILID])
          totalDAAP = 0.0
          valuesOut = []
      Severity: Minor
      Found in tactusVisualize.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

      Function main has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      def main(argv):
          with sys.stdout as csvFile:
              csvWriter = csv.DictWriter(csvFile,fieldnames=FIELDNAMES)
              csvWriter.writeheader()
              for inFileName in argv[1:]:
      Severity: Minor
      Found in getDiaries.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

      Consider simplifying this complex logical expression.
      Open

              if re.search(DATEPATTERN1,line) or \
                 re.search(DATEPATTERN2,line) or \
                 re.search(DATEPATTERN3,line) or \
                 re.search(DATEPATTERN4,line): 
                  date = findDate(line,inFileName)
      Severity: Critical
      Found in ovk2table.py - About 2 hrs to fix

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

        def compressPER(tokens):
            counter = 0
            while counter < len(tokens):
                if tokens[counter] != PER: counter += 1
                else:
        Severity: Minor
        Found in anonymize.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 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 tactus2liwc-nl.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 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 tactus2liwc-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 main has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        def main(argv):
            csvreader = csv.DictReader(sys.stdin,delimiter=SEPARATOR)
            csvwriter = csv.DictWriter(sys.stdout, delimiter=SEPARATOR,fieldnames=FIELDNAMES,restval="NA",lineterminator="\n")
            csvwriter.writeheader()
            data = {}
        Severity: Minor
        Found in computeAveragesPerPerson.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 main has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        def main(argv):
            duplicateColumns = None
            csvreader = csv.DictReader(sys.stdin,delimiter=',',quotechar='"')
            fieldNames = None
            csvwriter = None
        Severity: Minor
        Found in combineColumns.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 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 text2liwc has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        def text2liwc(features,words,prefixes,tokens):
            global numberId
        
            counts = { NBROFMATCHES:0 }
            for token in tokens:
        Severity: Minor
        Found in tactus2liwc-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

        Severity
        Category
        Status
        Source
        Language