almlab/angst

View on GitHub
angst_lib/output.py

Summary

Maintainability
D
1 day
Test Coverage

Function PrintLeafEvents has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

def PrintLeafEvents(this_node,output_file):

  if this_node.leaf_event_list is None:
    this_node.leaf_event_list = []

Severity: Minor
Found in angst_lib/output.py - About 4 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 SaveResults has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def SaveResults(output_args):
  ''' write the results of AnGSTs analysis to file '''

  model = output_args["model"]
  results_dirs = output_args["results"]
Severity: Major
Found in angst_lib/output.py - About 2 hrs to fix

    File output.py has 276 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/python
    # AnGST
    
    import os
    import pdb
    Severity: Minor
    Found in angst_lib/output.py - About 2 hrs to fix

      Function PrintEventList has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      def PrintEventList(events,out_list):
        '''print out events.  recurse if the list actually has another list
        in it'''
        if type(events) == type(""):
          if len(events) > 0:
      Severity: Minor
      Found in angst_lib/output.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 GetPaths has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def GetPaths(root_node,this_node,root_lca,this_lca,path_dict,output_f):
        last_stop = True
        if this_lca.AreRelated(root_lca):
          for kid in this_node.kid_nodes:
            kid_lca = this_node.lca_map[this_lca][kid]
      Severity: Minor
      Found in angst_lib/output.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 GetPaths has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def GetPaths(root_node,this_node,root_lca,this_lca,path_dict,output_f):
      Severity: Minor
      Found in angst_lib/output.py - About 45 mins to fix

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

        def SaveResults(output_args):
          ''' write the results of AnGSTs analysis to file '''
        
          model = output_args["model"]
          results_dirs = output_args["results"]
        Severity: Minor
        Found in angst_lib/output.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

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

        def GetBranchDists(this_node,this_lca,parent_lca,path_dict,output_f):
        Severity: Minor
        Found in angst_lib/output.py - About 35 mins to fix

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

          def PrintAllEvents(this_node,lca,output_file):
            event_counts = {'hgt':0, 'dup':0, 'los':0, 'spc':0}
            events = this_node.raw_list
            for event in events:
              output_file.write(event + "\n")
          Severity: Minor
          Found in angst_lib/output.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