thoth-station/thamos

View on GitHub

Showing 42 of 44 total issues

Function _traverse_edges has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

Function workdir has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def workdir(file_lookup: Optional[str] = None, warn_on_dir_change: bool = True) -> None:
"""Find project directory and cd into it."""
file_lookup = file_lookup or ".thoth.yaml"
 
project_dir = os.getcwd()
Severity: Minor
Found in thamos/utils.py - About 55 mins to fix

Avoid deeply nested control flow statements.
Open

for message, metric in scorecards_metrics.items():
Console().print(f"- {metric}% of {message}\n")
 
 
Severity: Major
Found in thamos/cli.py - About 45 mins to fix

Function get_verified_packages_from_static_analysis has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def get_verified_packages_from_static_analysis(
Severity: Minor
Found in thamos/lib.py - About 45 mins to fix

Function _print_report has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def _print_report(
Severity: Minor
Found in thamos/cli.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

if key == "package_extract_document_id":
container_image_search_link = (
f"{configuration.thoth_search_ui_url}image/{value}"
)
key = _REPORT_TRANSLATION_TABLE_IMAGES.get(
Severity: Major
Found in thamos/cli.py - About 45 mins to fix

Function get_static_analysis has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def get_static_analysis(
Severity: Minor
Found in thamos/lib.py - About 35 mins to fix

Function results has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def results(
Severity: Minor
Found in thamos/cli.py - About 35 mins to fix

Function _wait_for_analysis has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def _wait_for_analysis(
Severity: Minor
Found in thamos/lib.py - About 35 mins to fix

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

def provenance_check(
Severity: Minor
Found in thamos/cli.py - About 35 mins to fix

Function create_default_config has a Cognitive Complexity of 7 (exceeds 5 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 35 mins to fix

Function discover_base_image has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def discover_base_image() -> Optional[str]:
"""Discover base image and its version."""
# IMAGE_NAME and IMAGE_TAG injected by AICoE-CI take precedence over Thoth s2i.
base_image_name = os.getenv("IMAGE_NAME", os.getenv("THOTH_S2I_NAME"))
base_image_version = os.getenv("IMAGE_TAG")
Severity: Minor
Found in thamos/discover.py - About 35 mins to fix

Function _print_version has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _print_version(ctx, json_output: bool = False):
"""Print Thamos and Thoth version and exit."""
api_url = None
thoth_version = None
try:
Severity: Minor
Found in thamos/cli.py - About 35 mins to fix

Function discover_rpm_package has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def discover_rpm_package(package_name: str) -> Optional[Dict[str, str]]:
"""Check for version of a RPM package and return None if not found."""
result = run_command(f"rpm -qa | grep {package_name}", raise_on_error=False)
 
if result.return_code != 0:
Severity: Minor
Found in thamos/discover.py - About 35 mins to fix

Avoid too many return statements within this function.
Open

return run_command(f"echo {_LSPCI_OUTPUT}")
Severity: Major
Found in tests/test_discover.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

return run_command("exit 1", raise_on_error=False)
Severity: Major
Found in tests/test_discover.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

return run_command("exit 1", raise_on_error=False)
Severity: Major
Found in tests/test_discover.py - About 30 mins to fix

Avoid too many return statements within this function.
Open

return run_command(f"echo {_OPENMPI_RPM_OUTPUT}")
Severity: Major
Found in tests/test_discover.py - About 30 mins to fix

Function api_discovery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def api_discovery(self, host: str) -> str:
"""Discover API versions available, return the most recent one supported by client and server."""
api_url = urljoin("https://" + host, "api/v1")
self.tls_verify = (
self.tls_verify
Severity: Minor
Found in thamos/config.py - About 25 mins to fix

Function _mock_run_command_available has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _mock_run_command_available(*args, **kwargs) -> CommandResult:
"""Mock run_command when information is available."""
if args[0] == "nvcc --version":
return run_command(f"echo {_CUDA_VERSION_OUTPUT}")
 
 
Severity: Minor
Found in tests/test_discover.py - About 25 mins to fix
Severity
Category
Status
Source
Language