e-mental-health/data-processing

View on GitHub

Showing 133 of 166 total issues

Function checkFirstLastN has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def checkFirstLastN(mailSendersList,name,N):
    if N > 0:
        for i in range(0,N):
            if mailSendersList[i] == name: return(True)
        return(False)
Severity: Minor
Found in tactusCountCounselors.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 tactus2table.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 summarizeDataMail has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def summarizeDataMail(data,mailId):
    summary = {}
    if mailId >= 0 and mailId < len(data):
        row = data[mailId]
        for featureName in row:
Severity: Minor
Found in tactusVisualize.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 findSender has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def findSender(line,inFileName):
    match = re.search(SENDERPATTERN1+r" *(.*)",line)
    if match: sender = match.group(1)
    else:
        match = re.search(SENDERPATTERN2+r" *(.*)",line)
Severity: Minor
Found in ovk2table.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 12 (exceeds 5 allowed). Consider refactoring.
Open

def main(argv):
    capitalized = {}
    lowerCased = {}
    for line in sys.stdin:
        if not re.match(r"^.*<.*>.*$",line):
Severity: Minor
Found in getCapitalized.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 findReceiver has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

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

Consider simplifying this complex logical expression.
Open

            if tokens[i] in [MONTH,DATE,DAY]:
                if i < len(tokens)-1 and tokens[i+1] in [NUM,MONTH,DATE,DAY]: 
                    removeFromList(tokens,i+1)
                    removedTokens += 1
                tokens[i] = DATE
Severity: Critical
Found in anonymize-ovk.py - About 1 hr to fix

    Function removeTagText has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def removeTagText(tag,tagNamesKeepTextTrace):
        global clearedStringIds
    
        if not tag.text is None:
            if not tag.tag in tagNamesKeepTextTrace:
    Severity: Minor
    Found in tactus-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 printResults has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def printResults(features,results,clientids):
        printData = {}
        allFeatures = METADATA+list(features.values())
        extraFeatures = [ KEYPREFIX+x for x in allFeatures ]
        allFeatures.extend(extraFeatures)
    Severity: Minor
    Found in ovk2liwc.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 countPhrases has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def countPhrases(fileName,message):
        global phraseFrequencies,phraseInitialPos
    
        words = message.text.split()
        inDuplicate = False
    Severity: Minor
    Found in mark-duplicate-phrases.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 processMailHeader has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def processMailHeader(mailText,inFileName):
        date, receiver, receiverName, sender, senderName, subject = ("","","","","","")
        mailLines = mailText.split("\n")
        skipLines = 0
        for line in mailLines:
    Severity: Minor
    Found in ovk2table.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 getGenderDataFromVNW has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def getGenderDataFromVNW(processedText):
        genderData = {}
        for paragraph in processedText:
            for tokenData in paragraph:
                if re.match(r"^VNW\(",str(tokenData[POS])):
    Severity: Minor
    Found in egofy.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 getDiaryData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def getDiaryData(root,thisId):
        diaries = []
        subject = ""
        for entry in root.findall(DIARIES):
            date = ""
    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 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 main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def main(argv):
        options,args = processOptions(argv)
        expectedFields = -1
        for line in sys.stdin:
            fields = line.split()
    Severity: Minor
    Found in prepare-eval.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

    Consider simplifying this complex logical expression.
    Open

                    if nextCounter < len(tokens)-1 and \
                       tokens[nextCounter+1] == PER:
                        nextCounter += 1
                    elif nextCounter < len(tokens)-2 and \
                       tokens[nextCounter+1] in NAMEWORDS and \
    Severity: Major
    Found in anonymize.py - About 1 hr to fix

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

      def readSentence():
          tokens,pos,ner = [[],[],[]]
          for line in sys.stdin:
              try:
                  line = line.rstrip()
      Severity: Minor
      Found in anonymize-ovk.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 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

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

      def main(argv):
          try: optionList, files = getopt.getopt(argv,"i",[])
          except: sys.exit("usage: "+COMMAND+" [-i] < nerfile ")
          interactive = "i" in optionList
          ner,pos,tokens = [[],[],[]]
      Severity: Minor
      Found in anonymize.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 readSentence has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def readSentence():
          tokens,pos,ner = [[],[],[]]
          for line in sys.stdin:
              try:
                  line = line.rstrip()
      Severity: Minor
      Found in anonymize-eng.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

      Severity
      Category
      Status
      Source
      Language