avocado-framework/avocado

View on GitHub
avocado/core/nrunner/runnable.py

Summary

Maintainability
C
1 day
Test Coverage
B
89%

Consider possible security implications associated with subprocess module.
Open

import subprocess
Severity: Info
Found in avocado/core/nrunner/runnable.py by bandit

subprocess call - check for execution of untrusted input.
Open

            process = subprocess.Popen(
                cmd,
                stdin=subprocess.DEVNULL,
                stdout=subprocess.PIPE,
                stderr=subprocess.DEVNULL,
Severity: Info
Found in avocado/core/nrunner/runnable.py by bandit

File runnable.py has 420 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import base64
import collections
import json
import logging
import subprocess
Severity: Minor
Found in avocado/core/nrunner/runnable.py - About 6 hrs to fix

    Runnable has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Runnable:
        """
        Describes an entity that be executed in the context of a task
    
        A instance of :class:`BaseRunner` is the entity that will actually
    Severity: Minor
    Found in avocado/core/nrunner/runnable.py - About 2 hrs to fix

      Function get_command_args has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_command_args(self):
              """
              Returns the command arguments that adhere to the runner interface
      
              This is useful for building 'runnable-run' and 'task-run' commands
      Severity: Minor
      Found in avocado/core/nrunner/runnable.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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, kind, uri, *args, config=None, **kwargs):
      Severity: Minor
      Found in avocado/core/nrunner/runnable.py - About 35 mins to fix

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

            def from_avocado_config(cls, kind, uri, *args, config=None, **kwargs):
        Severity: Minor
        Found in avocado/core/nrunner/runnable.py - About 35 mins to fix

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

              def pick_runner_command(kind, runners_registry=None):
                  """Selects a runner command based on the runner kind.
          
                  And when finding a suitable runner, keeps found runners in registry.
          
          
          Severity: Minor
          Found in avocado/core/nrunner/runnable.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

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

              def get_dict(self):
                  """
                  Returns a dictionary representation for the current runnable
          
                  This is usually the format that will be converted to a format
          Severity: Minor
          Found in avocado/core/nrunner/runnable.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