Function check_metric_supports_source
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_metric_supports_source(self) -> None:
"""Check that the source parameters refer to metrics that list the source as allowed source."""
for source_key, source in self.sources.items():
for parameter_key, parameter in source.parameters.items():
for metric_key in parameter.metrics:
- 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 check_source_has_parameters_for_each_supported_metric
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_source_has_parameters_for_each_supported_metric(self) -> None:
"""Check that the sources have at least one parameter for each metric supported by the source."""
for metric_key, metric in self.metrics.items():
for source_key in metric.sources:
source = self.sources[source_key]
- 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 check_source_configuration
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_source_configuration(self, source_key, configuration) -> None:
"""Check that the metrics listed by the source configuration have the source as supported source."""
for configuration_key, configuration_value in configuration.items():
for metric_key in configuration_value.metrics:
if metric_key not in self.metrics:
- 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 check_logos
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_logos(self) -> None:
"""Check that a logo exists for each source and vice versa."""
logos_path = pathlib.Path(__file__).parent.parent / "logos"
for source_type in self.sources:
logo_path = logos_path / f"{source_type}.png"
- 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"