almlab/angst

View on GitHub

Showing 70 of 94 total issues

Function TryDL has a Cognitive Complexity of 245 (exceeds 5 allowed). Consider refactoring.
Open

def TryDL(parent1,parent2,node1,node2,node_link,lca_tables):
    ''' evalute vanilla (just duplication and loss) reconciliation
    scenarios '''

    # load in necessary variables
Severity: Minor
Found in angst_lib/reconcile.py - About 5 days 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 TryTransfer has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
Open

def TryTransfer(parent1,parent2,node1,node2,node_link,lca_tables):
    ''' evaluate putative transfer scenarios '''

    # load in necessary variables
    model = node_link.model
Severity: Minor
Found in angst_lib/reconcile.py - About 2 days 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

File reconcile.py has 733 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# stick all the reconciliation-related code in here

import sys
import pdb
import math
Severity: Major
Found in angst_lib/reconcile.py - About 1 day to fix

    Function RunAnGST has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
    Open

    def RunAnGST(input_dict):
    
        # unpack input variables
        input_info = input_dict['input_info']
        mem_str = input_dict['mem_str']
    Severity: Minor
    Found in angst_lib/AnGSTHelper.py - About 1 day 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 ReadInput has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def ReadInput(self,filename):
            '''store arguments from input datafile'''
            input_file = open(filename,'r')
            for line in input_file:
    
    
    Severity: Minor
    Found in angst_lib/AnGSTInput.py - About 5 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 LocalReconcile has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

    def LocalReconcile(this_node,parent_node,node_link):
        '''perform a reconciliation at a single node/parent combination
        note that there is no recursion'''
    
        model = node_link.model
    Severity: Minor
    Found in angst_lib/reconcile.py - About 5 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

    File node.py has 367 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import sys
    import pdb
    import math
    import multitree
    import branch
    Severity: Minor
    Found in tree_lib/node.py - About 4 hrs to fix

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

          def UnrootPrint(self):
              ''' take in a rooted tree and return an unrooted one '''
      
              if self.root is None:
                  print "sorry, need to start with a rooted tree"
      Severity: Minor
      Found in tree_lib/multitree.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

      node has 31 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class node:
      
          def __init__(self,raw_name,arbre):
              # remove any leading angled brackets
              raw_name = raw_name.lstrip(">")
      Severity: Minor
      Found in tree_lib/node.py - About 3 hrs to fix

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

                def __init__(self,input_info):
            
                    # take input penalties
                    penalty_scale = math.pow(10,input_info.penalty_weight)
                    if input_info.penalties_filename is not None:
            Severity: Minor
            Found in angst_lib/reconcile.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 UpdateScores has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            def UpdateScores(lca_lookups,lcas_lca,res):
                ''' update scores in lca lookup tables '''
            
                sscore = res['score']
                ranges = res['range']
            Severity: Minor
            Found in angst_lib/reconcile.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

            File multitree.py has 264 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # object class for construction of rooted and unrooted binary trees.
            #
            # lawrence david - ldavid@mit.edu - 2006.
            
            import re
            Severity: Minor
            Found in tree_lib/multitree.py - About 2 hrs to fix

              Function DistTo has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  def DistTo(this_node,that_node,this_branch=None,dist=0):
                      # what to do at the end
                      if this_node is that_node:
                          return True, dist
                      # if not ...
              Severity: Minor
              Found in tree_lib/node.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 CountLosses has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              def CountLosses(this_node,node_range,node_link):
                  ''' recursively count losses '''
              
                  species_tree = this_node.tree
              
              
              Severity: Minor
              Found in angst_lib/reconcile.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 MiniReconcile has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              def MiniReconcile(tree,node1,node2,node_link):
                  ''' perform a speciation / duplication / loss reconciliation '''
              
                  k = [node1,node2]
                  k.sort()
              Severity: Minor
              Found in angst_lib/reconcile.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 RecursiveBuild has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  def RecursiveBuild(self,newick):
                      ''' recursively populate tree '''
              
                  # handle the case when you reach a trifurcating node (so
                  # unrooted), by looking for when you've got a stretch of 2
              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 imposeHierarchy has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  def imposeHierarchy(self):
                  '''find all the child nodes that have yet to be visited and
                  assign their children'''
              
                  for kid_branch in self.child_branches:
              Severity: Minor
              Found in tree_lib/node.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

              Severity
              Category
              Status
              Source
              Language