Showing 11 of 446 total issues
Function subst_all_hashpairs
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def subst_all_hashpairs(self, structure, callback):
"""
Parse "structure" and replace all the pairs of hashes by the result of calling callback() on the pair content
#expr()expr# are treated differently by calling subst_one_hashpair()
The result is a string (like structure)
- 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
File Process.py
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
import eHive.Params
import os
import sys
import json
Function param_substitute
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def param_substitute(self, structure):
"""
Take any structure and replace the pairs of hashes with the values of the parameters / expression they represent
Compatible types: numbers, strings, lists, dictionaries (otherwise, ParamSubstitutionException is raised)
"""
- 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
Function subst_one_hashpair
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def subst_one_hashpair(self, inside_hashes, is_expr):
"""
Run the parameter substitution for a single pair of hashes.
Here, we only need to handle #expr()expr#, #func:params# and #param_name#
as each condition has been parsed in the other methods
- 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
Function __main
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __main():
seed_params = [
('alpha' , 2),
('beta' , 5),
('delta' , '#expr( #alpha#*#beta# )expr#'),
Function __job_life_cycle
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __job_life_cycle(self, config):
"""Job's life-cycle. See GuestProcess for a description of the protocol to communicate with the parent"""
self.__print_debug("__life_cycle")
# Params
- 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
Function __main
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __main():
seed_params = [
('alpha' , 2),
('beta' , 5),
('delta' , '#expr( #alpha#*#beta# )expr#'),
- 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 too many return
statements within this function. Open
return self.subst_one_hashpair(structure[1:-1], False)
Avoid too many return
statements within this function. Open
return structure
Avoid too many return
statements within this function. Open
return self.subst_all_hashpairs(structure, lambda middle_param: self.subst_one_hashpair(middle_param, False) )
Avoid too many return
statements within this function. Open
return self.subst_one_hashpair(structure[1:-1], True)