avocado-framework/avocado

View on GitHub
avocado/core/nrunner.py

Summary

Maintainability
D
2 days
Test Coverage
D
65%

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.py by bandit

subprocess call - check for execution of untrusted input.
Open

        process = subprocess.Popen(
            [self.runnable.uri] + list(self.runnable.args),
            stdin=subprocess.DEVNULL,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
Severity: Info
Found in avocado/core/nrunner.py by bandit

Consider possible security implications associated with subprocess module.
Open

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

File nrunner.py has 832 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3

import abc
import argparse
import base64
Severity: Major
Found in avocado/core/nrunner.py - About 2 days to fix

    Function run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(self):
            env = None
            if self.runnable.kwargs:
                current = dict(os.environ)
                current.update(self.runnable.kwargs)
    Severity: Minor
    Found in avocado/core/nrunner.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 get_command_args has a Cognitive Complexity of 10 (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.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.
    Wontfix

        def __init__(self, runnable, identifier=None, status_uris=None,
    Severity: Minor
    Found in avocado/core/nrunner.py - About 35 mins to fix

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

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

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

            def pick_runner_class_from_entry_point(self):
                """Selects a runner class from entry points based on kind.
        
                This is related to the :data:`SpawnMethod.PYTHON_CLASS`. This
                complements the :data:`RUNNERS_REGISTRY_PYTHON_CLASS` on systems
        Severity: Minor
        Found in avocado/core/nrunner.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 _uri_to_unittest_name has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def _uri_to_unittest_name(uri):
                if ':' in uri:
                    module, class_method = uri.rsplit(':', 1)
                else:
                    module = uri
        Severity: Minor
        Found in avocado/core/nrunner.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 pick_runner_command has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def pick_runner_command(self, runners_registry=None):
                """Selects a runner command based on the runner.
        
                And when finding a suitable runner, keeps found runners in registry.
        
        
        Severity: Minor
        Found in avocado/core/nrunner.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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(self):
                if not self.runnable.uri:
                    error_msg = 'uri is required but was not given'
                    yield self.prepare_status('finished', {'result': 'error',
                                                           'output': error_msg})
        Severity: Minor
        Found in avocado/core/nrunner.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 _setup_parser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _setup_parser(self, prog, description):
                self.parser = argparse.ArgumentParser(prog=prog,
                                                      description=description)
                subcommands = self.parser.add_subparsers(dest='subcommand')
                subcommands.required = True
        Severity: Minor
        Found in avocado/core/nrunner.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

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

            def decode_set(config_dict):
                for k, v in config_dict.items():
                    if isinstance(v, dict):
                        if '__encoded_set__' in v:
                            config_dict[k] = set(v['__encoded_set__'])
        Severity: Minor
        Found in avocado/core/nrunner.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