thoth-station/thamos

View on GitHub

Showing 42 of 44 total issues

File config.py has 687 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3
# thamos
# Copyright(C) 2018 - 2021 Fridolin Pokorny
#
# This program is free software: you can redistribute it and / or modify
Severity: Major
Found in thamos/config.py - About 1 day to fix

Function discover_cudnn_version has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def discover_cudnn_version() -> Optional[str]:
    """Discover CuDNN version and return None if not found."""
    result = run_command("nvcc --version", raise_on_error=False)

    if result.return_code != 0:
Severity: Minor
Found in thamos/discover.py - About 4 hrs 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 advise has 27 arguments (exceeds 4 allowed). Consider refactoring.
Open

def advise(
Severity: Major
Found in thamos/lib.py - About 3 hrs to fix

Function advise_here has 23 arguments (exceeds 4 allowed). Consider refactoring.
Open

def advise_here(
Severity: Major
Found in thamos/lib.py - About 2 hrs to fix

Function advise_using_config has 22 arguments (exceeds 4 allowed). Consider refactoring.
Open

def advise_using_config(
Severity: Major
Found in thamos/lib.py - About 2 hrs to fix

Function _print_report has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

def _print_report(
    report: list,
    *,
    json_output: bool = False,
    title: Optional[str] = None,
Severity: Minor
Found in thamos/cli.py - About 2 hrs 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 get_runtime_environment has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def get_runtime_environment(self, name: Optional[str] = None) -> Dict[str, Any]:
        """Get runtime environment, retrieve the first runtime environment (the default one) if no name is provided."""
        content = self.content
        if "runtime_environments" not in content:
            raise NoRuntimeEnvironmentError(
Severity: Minor
Found in thamos/config.py - About 2 hrs 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

File discover.py has 266 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3
# thamos
# Copyright(C) 2018 - 2021 Fridolin Pokorny
#
# This program is free software: you can redistribute it and / or modify
Severity: Minor
Found in thamos/discover.py - About 2 hrs to fix

Function _compute_metrics_scorecards has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def _compute_metrics_scorecards(report) -> Optional[OrderedDict]:
    """Aggregate OSSF Scorecards information from report and compute metrics."""
    nb_dependencies = 0
    scorecards_metrics = {}

Severity: Minor
Found in thamos/cli.py - About 2 hrs 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 discover_cpu has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Confirmed

def discover_cpu() -> Dict[str, Union[str, int, None]]:
    """Discover CPU model, model name and family."""
    result = {
        "cpu_family": None,
        "cpu_model": None,
Severity: Minor
Found in thamos/discover.py - About 2 hrs 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 advise has 16 arguments (exceeds 4 allowed). Consider refactoring.
Open

def advise(
Severity: Major
Found in thamos/cli.py - About 2 hrs to fix

Function build_analysis has 16 arguments (exceeds 4 allowed). Consider refactoring.
Open

def build_analysis(
Severity: Major
Found in thamos/lib.py - About 2 hrs to fix

Function provenance_check has 13 arguments (exceeds 4 allowed). Consider refactoring.
Open

def provenance_check(
Severity: Major
Found in thamos/lib.py - About 1 hr to fix

Function image_analysis has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

def image_analysis(
Severity: Major
Found in thamos/lib.py - About 1 hr to fix

Function list_thoth_container_images has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

def list_thoth_container_images(
Severity: Major
Found in thamos/lib.py - About 1 hr to fix

Function images has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

def images(
Severity: Major
Found in thamos/cli.py - About 1 hr to fix

Function provenance_check_here has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

def provenance_check_here(
Severity: Major
Found in thamos/lib.py - About 1 hr to fix

Function run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def run(
    command: typing.List[str],
    runtime_environment: Optional[str] = None,
    no_pedantic: bool = False,
) -> None:  # noqa: D412
Severity: Minor
Found in thamos/cli.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 create_default_config has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def create_default_config(
        self, template: Optional[str] = None, nowrite: bool = False
    ) -> Optional[dict]:
        """Place default configuration into the current directory."""
        if not os.path.isdir(".git"):
Severity: Minor
Found in thamos/config.py - About 1 hr to fix

Function _parse_labels has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _parse_labels(label: Optional[str]) -> Optional[Dict[str, str]]:
    """Parse labels from their string representation."""
    if not label:
        return None

Severity: Minor
Found in thamos/cli.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

Severity
Category
Status
Source
Language