avocado-framework/avocado

View on GitHub
avocado/utils/softwareraid.py

Summary

Maintainability
A
1 hr
Test Coverage

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

        output = process.run(cmd, ignore_status=True, shell=True)
Severity: Minor
Found in avocado/utils/softwareraid.py by bandit

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

        result = process.run(cmd, shell=True, sudo=True, ignore_status=True)
Severity: Minor
Found in avocado/utils/softwareraid.py by bandit

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

        if process.system(cmd, ignore_status=True, shell=True) != 0:
Severity: Minor
Found in avocado/utils/softwareraid.py by bandit

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

    def __init__(self, name, level, disks, metadata, spare_disks=None):
Severity: Minor
Found in avocado/utils/softwareraid.py - About 35 mins to fix

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

        def _run_command(self, cmd, log_details=True, check_recovery=False):
            if process.system(cmd, ignore_status=True, shell=True) != 0:
                if log_details:
                    self.get_detail()
                return False
    Severity: Minor
    Found in avocado/utils/softwareraid.py - About 35 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