almlab/angst

View on GitHub

Showing 94 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            elif num_kids_rght > 1:
                rght_kids = []
                for i in kid_list[1].child_branches:
                    for j in i.ends:
                        if j is not kid_list[1]:
    Severity: Major
    Found in tree_lib/multitree.py and 1 other location - About 1 day to fix
    tree_lib/multitree.py on lines 332..340

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 128.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            if num_kids_left > 1:
                left_kids = []
                for i in kid_list[0].child_branches:
                    for j in i.ends:
                        if j is not kid_list[0]:
    Severity: Major
    Found in tree_lib/multitree.py and 1 other location - About 1 day to fix
    tree_lib/multitree.py on lines 341..349

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 128.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            if len(node2.branch_list) < 2:
                node2_name =  node2.name + ":" + str(len2)
            else:
                node2_name = node2_lca_newick[lca2] + ":" + str(len2)
        Severity: Major
        Found in angst_lib/reconcile.py and 1 other location - About 3 hrs to fix
        angst_lib/reconcile.py on lines 970..973

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 67.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            if len(node1.branch_list) < 2:
                node1_name = node1.name + ":" + str(len1)
            else:
                node1_name = node1_lca_newick[lca1] + ":" + str(len1)
        Severity: Major
        Found in angst_lib/reconcile.py and 1 other location - About 3 hrs to fix
        angst_lib/reconcile.py on lines 975..978

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 67.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                if lca_tables is None:
                    if sscore > node_link.best_score:
                        continue
                else:
                    cur_lca_scores = lca_tables['scores']
        Severity: Major
        Found in angst_lib/reconcile.py and 1 other location - About 3 hrs to fix
        angst_lib/reconcile.py on lines 781..787

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

                if lca_tables is None:
                    if sscore > node_link.best_score:
                        continue
                else:
                    cur_lca_scores = lca_tables['scores']
        Severity: Major
        Found in angst_lib/reconcile.py and 1 other location - About 3 hrs to fix
        angst_lib/reconcile.py on lines 755..761

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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 __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

            Severity
            Category
            Status
            Source
            Language