avocado-framework/avocado

View on GitHub
selftests/unit/utils/test_process.py

Summary

Maintainability
D
1 day
Test Coverage

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

        p = process.SubProcess(cmd='ls -l', sudo=True, shell=True)
Severity: Minor
Found in selftests/unit/utils/test_process.py by bandit

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

        p = process.SubProcess(cmd='ls -l', sudo=True, shell=True)
Severity: Minor
Found in selftests/unit/utils/test_process.py by bandit

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

        p = process.SubProcess(cmd='ls -l', sudo=True, shell=True)
Severity: Minor
Found in selftests/unit/utils/test_process.py by bandit

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

        p = process.run(cmd='ls -l', sudo=True, shell=True, ignore_status=True)
Severity: Minor
Found in selftests/unit/utils/test_process.py by bandit

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

        p = process.run(cmd='ls -l', sudo=True, shell=True, ignore_status=True)
Severity: Minor
Found in selftests/unit/utils/test_process.py by bandit

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

        p = process.run(cmd='ls -l', sudo=True, shell=True, ignore_status=True)
Severity: Minor
Found in selftests/unit/utils/test_process.py by bandit

File test_process.py has 599 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import io
import logging
import os
import sys
import time
Severity: Major
Found in selftests/unit/utils/test_process.py - About 1 day to fix

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

        def test_send_signal_sudo_enabled_with_exception(self, run, get_children,
    Severity: Minor
    Found in selftests/unit/utils/test_process.py - About 35 mins to fix

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

          def test_kill_process_tree_timeout_3s(self, pid_exists, sleep, p_time,
      Severity: Minor
      Found in selftests/unit/utils/test_process.py - About 35 mins to fix

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

            def test_send_signal_sudo_enabled(self, run, get_children, get_pid, sudo, _):
        Severity: Minor
        Found in selftests/unit/utils/test_process.py - About 35 mins to fix

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

              def test_kill_process_tree_dont_timeout_3s(self, pid_exists, sleep,
          Severity: Minor
          Found in selftests/unit/utils/test_process.py - About 35 mins to fix

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

                def test_flush_on_closed_handler(self):
                    handler = logging.StreamHandler(io.StringIO())
                    log = logging.getLogger("test_flush_on_closed_handler")
                    log.addHandler(handler)
                    read_fd, write_fd = os.pipe()
            Severity: Minor
            Found in selftests/unit/utils/test_process.py - About 25 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