DeveloperCAP/MLCAT

View on GitHub
lib/analysis/author/graph/interaction.py

Summary

Maintainability
C
1 day
Test Coverage

Function weighted_multigraph has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

def weighted_multigraph(graph_nodes, graph_edges, clean_data, output_dir, ignore_lat = False):
    """

    Calls other functions to generate graphs that show the interaction between authors either through multiple edges or
    through edge weights.
Severity: Minor
Found in lib/analysis/author/graph/interaction.py - About 6 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 add_to_weighted_graph has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def add_to_weighted_graph(graph_obj, discussion_graph, json_data, nbunch, node_enum=list()):
    """
    Add weighted edges to the DiGraph object recursively.

    :param graph_obj: Object for a directed graph with mulitple edges.
Severity: Minor
Found in lib/analysis/author/graph/interaction.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 add_to_multigraph has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def add_to_multigraph(graph_obj, discussion_graph, json_data, nbunch, label_prefix=''):
    """
    Add multiple edges to the MultiDiGraph object recursively.

    :param graph_obj: Object for a directed graph with mulitple edges.
Severity: Minor
Found in lib/analysis/author/graph/interaction.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

Avoid deeply nested control flow statements.
Open

                    if edge[0] in msgs_before_time and edge[1] in msgs_before_time:
                        discussion_graph.add_edge(*edge)
            edge_file.close()
Severity: Major
Found in lib/analysis/author/graph/interaction.py - About 45 mins to fix

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

    def add_to_weighted_graph(graph_obj, discussion_graph, json_data, nbunch, node_enum=list()):
    Severity: Minor
    Found in lib/analysis/author/graph/interaction.py - About 35 mins to fix

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

      def weighted_multigraph(graph_nodes, graph_edges, clean_data, output_dir, ignore_lat = False):
      Severity: Minor
      Found in lib/analysis/author/graph/interaction.py - About 35 mins to fix

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

        def add_to_multigraph(graph_obj, discussion_graph, json_data, nbunch, label_prefix=''):
        Severity: Minor
        Found in lib/analysis/author/graph/interaction.py - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status