Showing 42 of 44 total issues
Function _traverse_edges
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _traverse_edges(
- Create a ticketCreate a ticket
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()
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid deeply nested control flow statements. Open
for message, metric in scorecards_metrics.items():
Console().print(f"- {metric}% of {message}\n")
- Create a ticketCreate a ticket
Function get_verified_packages_from_static_analysis
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_verified_packages_from_static_analysis(
- Create a ticketCreate a ticket
Function _print_report
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _print_report(
- Create a ticketCreate a ticket
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(
- Create a ticketCreate a ticket
Function get_static_analysis
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_static_analysis(
- Create a ticketCreate a ticket
Function results
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def results(
- Create a ticketCreate a ticket
Function _wait_for_analysis
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _wait_for_analysis(
- Create a ticketCreate a ticket
Function provenance_check
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def provenance_check(
- Create a ticketCreate a ticket
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:
- Read upRead up
- Create a ticketCreate a ticket
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 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"):
- Read upRead up
- Create a ticketCreate a ticket
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_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")
- Read upRead up
- Create a ticketCreate a ticket
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 _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:
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid too many return
statements within this function. Open
return run_command(f"echo {_OPENMPI_RPM_OUTPUT}")
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return run_command("exit 1", raise_on_error=False)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return run_command("exit 1", raise_on_error=False)
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return run_command(f"echo {_LSPCI_OUTPUT}")
- Create a ticketCreate a ticket
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
- Read upRead up
- Create a ticketCreate a ticket
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 _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}")
- Read upRead up
- Create a ticketCreate a ticket
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"