Function generate_report
has a Cognitive Complexity of 65 (exceeds 6 allowed). Consider refactoring. Open
def generate_report(path, results, with_charts=False, small_file=False):
"""
Generate html report from results
:param path: Path to the output html file
- 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 get_failed_facts
has a Cognitive Complexity of 12 (exceeds 6 allowed). Consider refactoring. Wontfix
def get_failed_facts(dst_record, results, record_attr="records"):
"""Process facts about failures"""
name = dst_record.name
failures = 0
missing = 0
- 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 process_metadata
has a Cognitive Complexity of 10 (exceeds 6 allowed). Consider refactoring. Wontfix
def process_metadata(metadata, known_items, dst_env, small_file):
"""Generate extra entries used in html_results out of metadata"""
build = {}
for key in ["build", "machine", "machine_url", "url", "distro",
"runperf_cmd"]:
- 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
Refactor this function to reduce its Cognitive Complexity from 315 to the 15 allowed. Open
def generate_report(path, results, with_charts=False, small_file=False):
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.