avocado-framework/avocado

View on GitHub

Showing 490 of 907 total issues

Function from_parameters has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def from_parameters(
Severity: Major
Found in avocado/utils/vmimage.py - About 1 hr to fix

    Function _node_content_from_node has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _node_content_from_node(path, node, values, using):
        """Processes node values into the current node content"""
        for value in values:
            if isinstance(value, mux.MuxTreeNode):
                node.add_child(value)

    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 end_test has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def end_test(self, result, state):
            """
            Create the ResultsDB result, which corresponds to one test from
            the Avocado Job
            """
    Severity: Minor
    Found in optional_plugins/resultsdb/avocado_resultsdb/resultsdb.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 test_all_commands has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def test_all_commands(self):
            command_name = "service"
            # Test all commands except "set_target" which is tested elsewhere
            for cmd, _ in (
                (c, r)
    Severity: Minor
    Found in selftests/unit/utils/service.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 python_resolver has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def python_resolver(name, reference, find_tests):
        module_path, tests_filter = reference_split(reference)
        if tests_filter is not None:
            tests_filter = re.compile(tests_filter)
    
    
    Severity: Minor
    Found in avocado/plugins/resolvers.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 vg_ramdisk has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def vg_ramdisk(
        disk,
        vg_name,
        ramdisk_vg_size,
        ramdisk_basedir,
    Severity: Minor
    Found in avocado/utils/lv_utils.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_source has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_source(self, name, dest_path, build_option=None):
            """
            Downloads the source package and prepares it in the given dest_path
            to be ready to build.
    
    
    Severity: Minor
    Found in avocado/utils/software_manager/backends/yum.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 run_suite has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def run_suite(self, job, test_suite):
            summary = set()
    
            if not test_suite.enabled:
                job.interrupted_reason = f"Suite {test_suite.name} is disabled."
    Severity: Minor
    Found in avocado/plugins/runner_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 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 vg_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def vg_list(vg_name=None):
        """
        List all info about available volume groups.
    
        :param vg_name: name of the volume group to list or or None to list all
    Severity: Minor
    Found in avocado/utils/lv_utils.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 create_namespace has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_namespace(
            self,
            region="",
            bus="",
            n_type="pmem",
    Severity: Minor
    Found in avocado/utils/pmem.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 set_freq_governor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def set_freq_governor(governor="random"):
        """
        To change the given cpu frequency governor.
    
        :param governor: frequency governor profile name whereas `random` is default
    Severity: Minor
    Found in avocado/utils/cpu.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 iso has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def iso(
        output_path,
        instance_id,
        username=None,
        password=None,
    Severity: Minor
    Found in avocado/utils/cloudinit.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_buddy_info has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_buddy_info(chunk_sizes, nodes="all", zones="all"):
        """
        Get the fragment status of the host.
    
        It uses the same method to get the page size in buddyinfo. The expression
    Severity: Minor
    Found in avocado/utils/memory.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 fail_on_dmesg has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def fail_on_dmesg(level=5):
        """Dmesg fail method decorator
    
        Returns a class decorator used to signal the test when DmesgError
        exception is raised.
    Severity: Minor
    Found in avocado/utils/dmesg.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_versions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_versions(self):
            """Return all available versions for the current parameters."""
            parser = VMImageHtmlParser(self.version_pattern)
            self._feed_html_parser(self.url_versions, parser)
    
    
    Severity: Minor
    Found in avocado/utils/vmimage.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_datadir has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_datadir(self, source):
            path_components = self._data_sources_mapping.get(source)
            if path_components is None:
                return
    
    
    Severity: Minor
    Found in avocado/core/test.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 run_suite has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def run_suite(self, job, test_suite):
            summary = set()
    
            if not test_suite.enabled:
                job.interrupted_reason = f"Suite {test_suite.name} is disabled."
    Severity: Minor
    Found in avocado/plugins/runner_nrunner.py - About 1 hr to fix

      Function __init__ has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def __init__(self, config=None, test_suites=None):
              """Creates an instance of Job class.
      
              Note that `config` and `test_suites` are optional, if not passed you
              need to change this before running your tests. Otherwise nothing will
      Severity: Minor
      Found in avocado/core/job.py - About 1 hr to fix

        Function run_and_check has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def run_and_check(
        Severity: Major
        Found in selftests/functional/basic.py - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language