Function prepare_benchmarks
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def prepare_benchmarks(self):
for bench in self.benchmarks:
if bench:
compared = False
for path, compared_mapping in self.compared_mapping.items():
- 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 display_cprofile
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def display_cprofile(self, tr):
section_displayed = False
for group in self.groups:
group_name, benchmarks = group
for benchmark in benchmarks:
- 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 handle_loading
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def handle_loading(self):
compared_mapping = {}
if self.compare:
if self.compare is True:
compared_benchmarks = list(self.storage.load())[-1:]
- 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 __init__
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, config):
self.verbose = config.getoption('benchmark_verbose')
self.quiet = False if self.verbose else config.getoption('benchmark_quiet')
level = Logger.QUIET if self.quiet else Logger.NORMAL
if self.verbose:
Function __init__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, config):
self.verbose = config.getoption('benchmark_verbose')
self.quiet = False if self.verbose else config.getoption('benchmark_quiet')
level = Logger.QUIET if self.quiet else Logger.NORMAL
if self.verbose:
- 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 handle_saving
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def handle_saving(self):
save = self.save or self.autosave
if save or self.json:
if not self.benchmarks:
if not self.disabled:
- 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
if self.compare_fail:
for check in self.compare_fail:
fail = check.fails(bench, flat_bench)
if fail:
self.performance_regressions.append((self.name_format(flat_bench), fail))