Showing 70 of 94 total issues
Avoid deeply nested control flow statements. Open
Open
for event in event0:
if 'los' in event:
los_parts = event.split(': ')
los_node = los_parts[1].replace('*','')
los_list.append(los_node)
Avoid deeply nested control flow statements. Open
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)
Function subtreeMap
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def subtreeMap(self,species_node):
# do the children of the current species node possess the
# relevant genes? if so, follow that child. if not, return
# the current node
- Read upRead up
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
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
Function GetPaths
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def GetPaths(root_node,this_node,root_lca,this_lca,path_dict,output_f):
Avoid deeply nested control flow statements. Open
Open
if found is True:
was_found = found
found_dist = new_dist
Avoid deeply nested control flow statements. Open
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:
Avoid deeply nested control flow statements. Open
Open
if node_link.best_score > sscore:
res['newick'] = MakeNewick(res,node_link,frac)
node_link.best_score = sscore
node_link.best_res = res
Avoid deeply nested control flow statements. Open
Open
if num_dups > 0:
dist_ratios.append('yes dup')
else:
dist_ratios.append('yes spc')
Avoid deeply nested control flow statements. Open
Open
for los in los_list:
raw_los_list.extend(los.split('-'))
for hgt in hgt_list:
Avoid deeply nested control flow statements. Open
Open
if event_guide is not None:
sscore -= EventGuideAdjust(event0,event_guide,model)
Function TryDL
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def TryDL(parent1,parent2,node1,node2,node_link,lca_tables):
Avoid deeply nested control flow statements. Open
Open
if event_guide is not None:
print "can't do both HR and event guiding!"
sys.exit(1)
# are there any losses proposed?
Avoid deeply nested control flow statements. Open
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]:
Avoid deeply nested control flow statements. Open
Open
if sscore > node_link.best_score:
break
else:
Avoid deeply nested control flow statements. Open
Open
for ind in range(len(los_list)):
los_list[ind] = "-" + los_list[ind] + "-"
los_list.sort(lambda a,b:len(a)-len(b))
Avoid deeply nested control flow statements. Open
Open
if parent is None:
upper_height = lower_height + 1.0
else:
upper_height = ultra_tree.height_dict[tree_link[parent]]
#endif
Function SaveResults
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def SaveResults(output_args):
''' write the results of AnGSTs analysis to file '''
model = output_args["model"]
results_dirs = output_args["results"]
- Read upRead up
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
Open
if child_branch is not kid_branch:
node.child_branches.append(child_branch)
node.imposeHierarchy()
# recursively label the roots of subtrees w/ the leaves contained
Function GetBranchDists
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def GetBranchDists(this_node,this_lca,parent_lca,path_dict,output_f):