almlab/angst

View on GitHub
angst_lib/reconcile.py

Summary

Maintainability
F
2 wks
Test Coverage

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

    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

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

    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

      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

                                        for event in event0:
                                            if 'los' in event:
                                                los_parts = event.split(': ')
                                                los_node = los_parts[1].replace('*','')
                                                los_list.append(los_node)
                    Severity: Major
                    Found in angst_lib/reconcile.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          for hgt in hgt_list:
                                              raw_hgt = hgt.split('-')
                                              for hgt_part in raw_hgt:
                                                  if hgt_part in raw_los_list:
                                                      raw_los_list.remove(hgt_part)
                      Severity: Major
                      Found in angst_lib/reconcile.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if sscore < node_link.max_float:
                                                # since python is insane, i can't directly
                                                # remove things from this list.  instead, i'll
                                                # just add them to a new list
                                                orig_los_count = 0
                        Severity: Major
                        Found in angst_lib/reconcile.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if num_dups < 1 and num_loss < 1:
                                                  event0.extend(["[spc]: " + str(lcas_lca.species)])
                                              # solicit input from event guide
                                              if event_guide is not None:
                          Severity: Major
                          Found in angst_lib/reconcile.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if node_link.best_score > sscore:
                                                    res['newick'] = MakeNewick(res,node_link,frac)
                                                    node_link.best_score = sscore
                                                    node_link.best_res = res
                            
                            
                            Severity: Major
                            Found in angst_lib/reconcile.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if num_dups > 0:
                                                      dist_ratios.append('yes dup')
                                                  else:
                                                      dist_ratios.append('yes spc')
                              
                              
                              Severity: Major
                              Found in angst_lib/reconcile.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    for los in los_list:
                                                        raw_los_list.extend(los.split('-'))
                                                    for hgt in hgt_list:
                                Severity: Major
                                Found in angst_lib/reconcile.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if event_guide is not None:
                                                          sscore -= EventGuideAdjust(event0,event_guide,model)
                                  
                                  
                                  Severity: Major
                                  Found in angst_lib/reconcile.py - About 45 mins to fix

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

                                    def TryDL(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 event_guide is not None:
                                                              print "can't do both HR and event guiding!"
                                                              sys.exit(1)
                                      
                                                          # are there any losses proposed?
                                      Severity: Major
                                      Found in angst_lib/reconcile.py - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                            for los in hgt_list:
                                                                matched = False
                                                                for ind in range(len(los_list)):
                                                                    this_los = "-" + los + "-"
                                                                    if this_los in los_list[ind]:
                                        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:
                                                                  break
                                                          else:
                                          Severity: Major
                                          Found in angst_lib/reconcile.py - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                for ind in range(len(los_list)):
                                                                    los_list[ind] = "-" + los_list[ind] + "-"
                                                                los_list.sort(lambda a,b:len(a)-len(b))
                                            Severity: Major
                                            Found in angst_lib/reconcile.py - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                  if parent is None:
                                                                      upper_height = lower_height + 1.0
                                                                  else:
                                                                      upper_height = ultra_tree.height_dict[tree_link[parent]]
                                                                  #endif
                                              Severity: Major
                                              Found in angst_lib/reconcile.py - About 45 mins to fix

                                                Function MergeNodeLinkDicts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                    def MergeNodeLinkDicts(self,other_dict):
                                                        '''merge lists of linked nodes'''
                                                
                                                        for leaves in other_dict:
                                                            if leaves in self.link_dict:
                                                Severity: Minor
                                                Found in angst_lib/reconcile.py - About 35 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

                                                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

                                                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

                                                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

                                                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

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

                                                                if parts[0].count('dup') > 0:
                                                                    self.dup_penalty = float(parts[1])*penalty_scale
                                                Severity: Major
                                                Found in angst_lib/reconcile.py and 3 other locations - About 1 hr to fix
                                                angst_lib/reconcile.py on lines 22..23
                                                angst_lib/reconcile.py on lines 24..25
                                                angst_lib/reconcile.py on lines 28..29

                                                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 45.

                                                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 4 locations. Consider refactoring.
                                                Open

                                                                if parts[0].count('los') > 0:
                                                                    self.los_penalty = float(parts[1])*penalty_scale
                                                Severity: Major
                                                Found in angst_lib/reconcile.py and 3 other locations - About 1 hr to fix
                                                angst_lib/reconcile.py on lines 22..23
                                                angst_lib/reconcile.py on lines 24..25
                                                angst_lib/reconcile.py on lines 26..27

                                                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 45.

                                                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 4 locations. Consider refactoring.
                                                Open

                                                                if parts[0].count('spc') > 0:
                                                                    self.spc_penalty = float(parts[1])*penalty_scale
                                                Severity: Major
                                                Found in angst_lib/reconcile.py and 3 other locations - About 1 hr to fix
                                                angst_lib/reconcile.py on lines 22..23
                                                angst_lib/reconcile.py on lines 26..27
                                                angst_lib/reconcile.py on lines 28..29

                                                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 45.

                                                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 4 locations. Consider refactoring.
                                                Open

                                                                if parts[0].count('hgt') > 0:
                                                                    self.hgt_penalty = float(parts[1])*penalty_scale
                                                Severity: Major
                                                Found in angst_lib/reconcile.py and 3 other locations - About 1 hr to fix
                                                angst_lib/reconcile.py on lines 24..25
                                                angst_lib/reconcile.py on lines 26..27
                                                angst_lib/reconcile.py on lines 28..29

                                                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 45.

                                                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 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 and 1 other location - About 1 hr to fix
                                                angst_lib/reconcile.py on lines 843..845

                                                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 44.

                                                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 model.luca == "Root" or model.special == "hr":
                                                                if lca1 is not species_tree.root:
                                                                    sscore = self.max_float
                                                Severity: Major
                                                Found in angst_lib/reconcile.py and 1 other location - About 1 hr to fix
                                                angst_lib/reconcile.py on lines 519..521

                                                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 44.

                                                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 parent1 not in node1.branch_dict:
                                                            len1 = parent1.branch_dict[node1].length
                                                        else:
                                                            len1 = node1.branch_dict[parent1].length
                                                Severity: Major
                                                Found in angst_lib/reconcile.py and 1 other location - About 1 hr to fix
                                                angst_lib/reconcile.py on lines 953..956

                                                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 43.

                                                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 parent2 not in node2.branch_dict:
                                                            len2 = parent2.branch_dict[node2].length
                                                        else:
                                                            len2 = node2.branch_dict[parent2].length
                                                Severity: Major
                                                Found in angst_lib/reconcile.py and 1 other location - About 1 hr to fix
                                                angst_lib/reconcile.py on lines 949..952

                                                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 43.

                                                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 parent is None:
                                                                        upper_height = lower_height + 1.0
                                                                    else:
                                                                        upper_height = ultra_tree.height_dict[tree_link[parent]]
                                                Severity: Major
                                                Found in angst_lib/reconcile.py and 1 other location - About 1 hr to fix
                                                angst_lib/reconcile.py on lines 214..217

                                                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 41.

                                                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 parent is None:
                                                                    upper_height = lower_height + 1.0
                                                                else:
                                                                    upper_height = ultra_tree.height_dict[tree_link[parent]]
                                                Severity: Major
                                                Found in angst_lib/reconcile.py and 1 other location - About 1 hr to fix
                                                angst_lib/reconcile.py on lines 477..480

                                                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 41.

                                                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 node_link.best_score > sscore:
                                                                        res['newick'] = MakeNewick(res,node_link,frac)
                                                                        node_link.best_score = sscore
                                                                        node_link.best_res = res
                                                Severity: Minor
                                                Found in angst_lib/reconcile.py and 1 other location - About 30 mins to fix
                                                angst_lib/reconcile.py on lines 847..850

                                                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 32.

                                                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 sscore < node_link.best_score:
                                                                res['newick'] = MakeNewick(res,node_link,frac)
                                                                node_link.best_score = sscore
                                                                node_link.best_res = res
                                                Severity: Minor
                                                Found in angst_lib/reconcile.py and 1 other location - About 30 mins to fix
                                                angst_lib/reconcile.py on lines 523..526

                                                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 32.

                                                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

                                                There are no issues that match your filters.

                                                Category
                                                Status