e-mental-health/data-processing

View on GitHub

Showing 133 of 166 total issues

Function findSubject has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def findSubject(line,inFileName):
    match = re.search(SUBJECTPATTERN1+r" *(.*)",line)
    if match: subject = match.group(1)
    else:
        match = re.search(SUBJECTPATTERN2+r" *(.*)",line)
Severity: Minor
Found in ovk2table.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

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 tactus2liwc-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

Function sentenceSplitLocal has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def sentenceSplitLocal(text):
    tokens = text.split()
    sentence = []
    sentences = []
    for token in tokens:
Severity: Minor
Found in tactus2table.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

Function makePlotDatesPart has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def makePlotDatesPart(fieldDataList,fieldNames,format,barwidth,dates,senders,target):
Severity: Major
Found in tactusVisualize.py - About 50 mins to fix

    Function visualizeDAAP has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def visualizeDAAP(file,user="",mail=-1,average=False,linemax=LINEMAX,equalwidth=False,table=False):
    Severity: Major
    Found in tactusVisualize.py - About 50 mins to fix

      Function makePlotDAAP has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def makePlotDAAP(fileName,data,index=-1,user="",average=False,linemax=LINEMAX,equalwidth=False):
      Severity: Major
      Found in tactusVisualize.py - About 50 mins to fix

        Function combineData has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def combineData(emails,sender,start,end,setSize,getLast=False):
        Severity: Minor
        Found in ovk2liwc.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if element.tag == DATE: data[DATE] = cleanupText(element.text)
                              elif element.tag == TIME: data[TIME] = cleanupText(element.text)
                              elif element.tag == URGE: data[URGE] = cleanupText(element.text)
                              elif element.tag == STANDARDUNITS: data[STANDARDUNITS] = cleanupText(element.text)
                              elif element.tag == MEASUREMENTUNITNAME: data[MEASUREMENTUNITNAME] = cleanupText(element.text)
          Severity: Major
          Found in getDiaries.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if featureName in summary: 
                                    summary[featureName] += 1
                                else: 
                                    summary[featureName] = 1
                return(summary)
            Severity: Major
            Found in tactusVisualize.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if numbers != None and len(numbers) > 0:
                                      questionNumber = cleanupText(numbers[0].text)
                                  else:
                                      questionNumber = str(int(questionNumber)+1)
                                  for elementQ in question:
              Severity: Major
              Found in getQuestions.py - About 45 mins to fix

                Function makePlotDates has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def makePlotDates(fieldDataList,fieldNames,format,barwidth,dates,senders):
                Severity: Minor
                Found in tactusVisualize.py - About 45 mins to fix

                  Function findDuplicateColumns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def findDuplicateColumns(columnNames):
                      duplicateColumns = REQUESTED
                      for columnName in columnNames:
                          shortName = re.sub(r"..$",r"",columnName)
                          if shortName in columnNames and not columnName in EXCEPTIONS:
                  Severity: Minor
                  Found in combineColumns.py - About 45 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

                  Avoid deeply nested control flow statements.
                  Open

                                      if not sentenceInitial:
                                          text += "\n"
                                          sentenceInitial = True
                                          lastPOS = ""
                                  else:
                  Severity: Major
                  Found in egofy.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if numbers != None and len(numbers) > 0:
                                            number = cleanupText(numbers[0].text)
                                        else:
                                            number = str(int(number)+1)
                                        for answer in question.findall(ANSWERS):
                    Severity: Major
                    Found in tactus2table.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          for columnName in sortKeys(columns.keys()):
                                              try: row.append(countsFilter(questionnaire[columnName],title))
                                              except: row.append(EMPTYTOKEN)
                                          csvwriter.writerow(row)
                      Severity: Major
                      Found in tactus2table.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            for elementQ in question:
                                                if elementQ.tag == TITLE: 
                                                    questionTitle = cleanupText(elementQ.text)
                                                if elementQ.tag == QUESTIONNUMBER: 
                                                    questionNumber = cleanupText(elementQ.text)
                        Severity: Major
                        Found in getQuestions.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              for columnName in sorted(columns.keys()): 
                                                  try: row.append(questionnaire[columnName])
                                                  except: row.append("")
                                              csvwriter.writerow(row)
                          Severity: Major
                          Found in tactus2liwc-nl.py - About 45 mins to fix

                            Function visualize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            def visualize(file,features,format="",barwidth=BARWIDTH,target=CLIENT,diaries=True):
                            Severity: Minor
                            Found in tactusVisualize.py - About 45 mins to fix

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

                              def main(argv):
                                  options,files,names = processOptions(argv)
                                  if "-p" in options: processedText = readPosFile(options["-p"])
                                  elif "-t" in options: processedText = processTextWithFrog(options["-t"])
                                  else: sys.exit(USAGE)
                              Severity: Minor
                              Found in egofy.py - About 45 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

                              Avoid deeply nested control flow statements.
                              Open

                                                  if featureName in summary: 
                                                      summary[featureName] += int(row[featureName])
                                                  else: 
                                                      summary[featureName] = int(row[featureName])
                                              else:
                              Severity: Major
                              Found in tactusVisualize.py - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language