avocado-framework/avocado

View on GitHub
avocado/utils/software_manager/backends/rpm.py

Summary

Maintainability
B
5 hrs
Test Coverage
F
26%

Function call with shell=True parameter identified, possible security issue.
Open

            cmd_result = process.run(cmd_format, verbose=False, shell=True)

Function call with shell=True parameter identified, possible security issue.
Open

            cmd_result = process.run("rpm -qa | sort", verbose=False, shell=True)

Function call with shell=True parameter identified, possible security issue.
Open

        process.run(f"rpm2cpio {abs_path} | cpio -dium -D {dest}", shell=True)

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

    def perform_setup(self, packages, no_dependencies=False):
        """
        General RPM setup with automatic handling of dependencies based on
        install attempts.

Severity: Minor
Found in avocado/utils/software_manager/backends/rpm.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 check_installed has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def check_installed(self, name, version=None, arch=None):
        """
        Check if package [name] is installed.

        :param name: Package name.
Severity: Minor
Found in avocado/utils/software_manager/backends/rpm.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 find_rpm_packages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def find_rpm_packages(self, rpm_dir):
        """
        Extract product dependencies from a defined RPM directory and all its subdirectories.

        :param str rpm_dir: directory to search in
Severity: Minor
Found in avocado/utils/software_manager/backends/rpm.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

Avoid too many return statements within this function.
Open

                return False
Severity: Major
Found in avocado/utils/software_manager/backends/rpm.py - About 30 mins to fix

    There are no issues that match your filters.

    Category
    Status