ICTU/quality-time

View on GitHub
components/shared_code/src/shared_data_model/meta/data_model.py

Summary

Maintainability
A
3 hrs
Test Coverage

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:
Severity: Minor
Found in components/shared_code/src/shared_data_model/meta/data_model.py - About 1 hr to fix

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]
Severity: Minor
Found in components/shared_code/src/shared_data_model/meta/data_model.py - About 55 mins to fix

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:
Severity: Minor
Found in components/shared_code/src/shared_data_model/meta/data_model.py - About 45 mins to fix

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"
Severity: Minor
Found in components/shared_code/src/shared_data_model/meta/data_model.py - About 25 mins to fix

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

There are no issues that match your filters.

Category
Status