PuzaTech/Fugue

View on GitHub
src/main/python/tm.py

Summary

Maintainability
B
6 hrs
Test Coverage

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

def load_models(args):
    files = args.model_file.split(',')
    topicsOrders = {}
    N = 0
    for file in files:
Severity: Minor
Found in src/main/python/tm.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 parse_docs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def parse_docs(dictionary, args):
    input_f = open(args.input_file, 'r')
    output_f = open(args.output_file,'w')
    doc_id = 0
    for line in input_f:
Severity: Minor
Found in src/main/python/tm.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 compute_term_stats has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def compute_term_stats(docs, args = None):
    """
    This function is to compute TF and DF stats
    :param docs:
    :return: a return obj with tf and df
Severity: Minor
Found in src/main/python/tm.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 load_raw has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def load_raw(args):
    input_f = open(args.input_file, 'r')
    docs = []
    for line in input_f:
        if line.strip()!='':
Severity: Minor
Found in src/main/python/tm.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 load_model has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def load_model(model_filename):
    json_file_content = ''
    input_f = open(model_filename, 'r')
    for line in input_f:
        json_file_content += line.strip()
Severity: Minor
Found in src/main/python/tm.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

There are no issues that match your filters.

Category
Status