e-mental-health/data-processing

View on GitHub

Showing 133 of 166 total issues

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

def getFieldTotal(row,prefix,suffix,convertor,maxIndex,addZero):
Severity: Minor
Found in extractMetaData.py - About 45 mins to fix

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

    def processOptions(argv):
        try:
            names = {}
            optionList, files = getopt.getopt(argv,"n:p:t:s",[])
            options = {}
    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 token in names and names[token] == COMPLETE:
                            if re.search(r"VZ",lastPOS): 
                                text += METOKEN[sentenceInitial]+" "
                            else: 
                                text += ITOKEN[sentenceInitial]+" "
    Severity: Major
    Found in egofy.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          for answer in question.findall(ANSWERS):
                              if ID in answer.attrib.keys(): key = answer.attrib[ID]
                              else: key = NOID
                              answerTexts = answer.findall("./answerText")
                              if len(answerTexts) > 0: value = cleanupText(answerTexts[0].text)
      Severity: Major
      Found in tactus2table.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 == SENDER: data[SENDER] = cleanupText(element.text)
                            elif element.tag == SUBJECT: 
                                wordCountSubject = wordCount(cleanupText(element.text))
                            elif element.tag == BODY: 
        Severity: Major
        Found in wordCount.py - About 45 mins to fix

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

            Function makeTableDAAP has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def makeTableDAAP(fileName,data,index=-1,user="",average=False):
            Severity: Minor
            Found in tactusVisualize.py - About 35 mins to fix

              Function makePlotIndexPart has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def makePlotIndexPart(fieldDataList,fieldNames,format,senders,target):
              Severity: Minor
              Found in tactusVisualize.py - About 35 mins to fix

                Function printMailText has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def printMailText(client,counselor,date,mailText,receiver):
                Severity: Minor
                Found in ovkPrepare.py - About 35 mins to fix

                  Function printResults has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def printResults(featureNames,results):
                      first = True
                      for featureName in featureNames:
                          if not first: print(",",end="")
                          else: first = False
                  Severity: Minor
                  Found in tactus2liwc-nl.py - About 35 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 fixCounselor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def fixCounselor(mails):
                      counselor = ""
                      for mail in mails:
                          if mail[COUNSELORID] != "": 
                              counselor = mail[COUNSELORID]
                  Severity: Minor
                  Found in ovk2table.py - About 35 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 analyzeText has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def analyzeText(text):
                      tokens = text.split()
                      nbrOfWords = 0
                      nbrOfCharsInWords = 0
                      nbrOfSents = 0
                  Severity: Minor
                  Found in ovk2table.py - About 35 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 makeNewFieldNames has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def makeNewFieldNames(fieldNamesIn):
                      fieldNamesOut = list(KEEP)
                      for field in fieldNamesIn:
                          if not field in KEEP and field != TIME:
                              for time in TIMES:
                  Severity: Minor
                  Found in table2wide.py - About 35 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 combineData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def combineData(emails,sender,start,end,setSize,getLast=False):
                      set = []
                      nbrOfUsed = 0
                      if not getLast:
                          i = start
                  Severity: Minor
                  Found in ovk2liwc.py - About 35 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 too many return statements within this function.
                  Open

                                  return(True)
                  Severity: Major
                  Found in egofy.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        else: return(True)
                    Severity: Major
                    Found in tactusCountCounselors.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return(False)
                      Severity: Major
                      Found in egofy.py - About 30 mins to fix

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

                        def getMailTexts(tree,tagNames):
                            root = tree.getroot()
                            textList = []
                            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 movingWeight has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def movingWeight(index,windowSize):
                            global movingWeights
                        
                            if str(index) in movingWeights: return(movingWeights[str(index)])
                            elif index <= -windowSize or index >= windowSize: 
                        Severity: Minor
                        Found in daap.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 markDuplicates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def markDuplicates(message,duplicateStarts,duplicateEnds,duplicateRefs):
                            words = message.text.split()
                            message.text = ""
                            wordIndex = 0
                            while len(duplicateStarts) > 0:
                        Severity: Minor
                        Found in mark-duplicate-phrases.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