almlab/angst

View on GitHub

Showing 70 of 94 total issues

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 MakeNewick has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def MakeNewick(res,node_link,frac):
    ''' generate the newick string '''

    node1 = res['node1']
    node2 = res['node2']
Severity: Minor
Found in angst_lib/reconcile.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 __init__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(self,raw_name,arbre):
        # remove any leading angled brackets
        raw_name = raw_name.lstrip(">")

        # handle mixed underscore and dot environment
Severity: Minor
Found in tree_lib/node.py - About 1 hr to fix

    Function GetSibDists has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def GetSibDists(self,species_tree):
            '''get distances between all siblings on the tree'''
            parent_dict = {}
            dist_list = []
            for leaf in self.leaf_dict.values():
    Severity: Minor
    Found in tree_lib/multitree.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 EventGuideAdjust has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def EventGuideAdjust(event_list,event_guide,model):
        ''' provide score adjustment based on event guide '''
        score_adjust = 0.0
        for event in event_list:
            if event in event_guide:
    Severity: Minor
    Found in angst_lib/reconcile.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 GetChildLeaves has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def GetChildLeaves(this_node,parent_node,other_nodes):
    
            merge_list = []
            for kid_node in other_nodes:
                if parent_node in this_node.leaf_dict:
    Severity: Minor
    Found in tree_lib/node.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 GetNodeLinkDict has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def GetNodeLinkDict(this_node,node_link_dict):
    
            this_node.link_dict_visited = True
            leaf_dict = this_node.leaf_dict
    
    
    Severity: Minor
    Found in tree_lib/node.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 UnrootedLeaving has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def UnrootedLeaving(this_node):
    
            other_nodes = this_node.GetOtherNodes()
            for parent_node in other_nodes:
                child_nodes = list(set(other_nodes).difference(set([parent_node])))
    Severity: Minor
    Found in tree_lib/node.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 model.luca == "Root" or model.special == "hr":
                            if ancestor is not species_tree.root:
                                sscore = self.max_float
    
    
    Severity: Major
    Found in angst_lib/reconcile.py - About 45 mins to fix

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

          def treePrint(self,newickString):
      
          count = 0
              # implement sorting so that you can compare trees in a quick
              # and dirty way
      Severity: Minor
      Found in tree_lib/node.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 node_pair[0].name == model.outgroup:
                              node_link.TryRoot(node_pair)
                          if node_pair[1].name == model.outgroup:
      Severity: Major
      Found in angst_lib/AnGSTHelper.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if len(raw_los_list) > 0:
                                sscore = node_link.max_float
        
                            # make sure losses only percolated down, not up
                            for ind in range(len(los_list)):
        Severity: Major
        Found in angst_lib/reconcile.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if sscore >= node_link.best_score:
                                  continue
                          else:
          Severity: Major
          Found in angst_lib/reconcile.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if num_dups > 0:
                                    # need to deal w/ situation where dups erase
                                    # information about ranges, which leads to
                                    # problems when you're trying to prevent time
                                    # paradoxes.  see notes from 05.25.10.
            Severity: Major
            Found in angst_lib/reconcile.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if node_relation == 1:
                                      this_paradox.append([hgt_str,accep_list])
                      else:
              Severity: Major
              Found in angst_lib/reconcile.py - About 45 mins to fix

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

                def TryTransfer(parent1,parent2,node1,node2,node_link,lca_tables):
                Severity: Minor
                Found in angst_lib/reconcile.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if ancestor in cur_lca_scores:
                                          if sscore > cur_lca_scores[ancestor]:
                                              continue
                  
                                  # results datastructure
                  Severity: Major
                  Found in angst_lib/reconcile.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        for event in event0:
                                            if 'hgt' in event:
                                                hgt_parts = event.split(' --> ')
                                                hgt_list.append(hgt_parts[1])
                    
                    
                    Severity: Major
                    Found in angst_lib/reconcile.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if node_pair[1].name == model.outgroup:
                                              node_link.TryRoot(node_pair)
                                      else:
                      Severity: Major
                      Found in angst_lib/AnGSTHelper.py - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language