avocado-framework/avocado

View on GitHub

Showing 490 of 907 total issues

Function register_option has 16 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def register_option(
Severity: Major
Found in avocado/core/settings.py - About 2 hrs to fix

    Function file_has_content has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def file_has_content(file_path, content, regex):
            """Check if a file has `content`."""
            if os.path.isfile(file_path):
                with open(file_path, "r", encoding="utf-8") as f:
                    lines = f.readlines()
    Severity: Minor
    Found in selftests/check.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 to_str has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_str(self, summary, variants, **kwargs):
            """
            Return human readable representation
    
            The summary/variants accepts verbosity where 0 means silent and

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

    def _mapping_to_tree_loader(loader, node, looks_like_node=False):
        """Maps yaml mapping tag to TreeNode structure"""
        _value = []
        for key_node, value_node in node.value:
            # Allow only strings as dict keys

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

    def parse_unified_diff_output(lines):
        """
        Parses the unified diff output of two files.
    
        :param lines: diff lines
    Severity: Minor
    Found in avocado/utils/diff_validator.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 pre has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def pre(self, job):
            for suite in job.test_suites:
                dependency_file_path = suite.config.get("job.run.dependency")
                if dependency_file_path:
                    try:
    Severity: Minor
    Found in avocado/plugins/dependency.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 provides has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def provides(self, name):
            """
            Return a list of packages that provide [name of package/file].
    
            :param name: File name.
    Severity: Minor
    Found in avocado/utils/software_manager/backends/apt.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_nslist_with_pci has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_nslist_with_pci(pci_address):
        """
        Fetches and returns list of namespaces for specified pci_address
    
        :param pci_address: pci_address of any nvme adapter
    Severity: Minor
    Found in avocado/utils/nvme.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_environment has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_environment(self):
            """Get node environment (values + preceding envs)"""
            if self._environment is None:
                self._environment = (
                    self.parent.environment.copy() if self.parent else TreeEnvironment()
    Severity: Minor
    Found in avocado/core/tree.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 map_method_with_return has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def map_method_with_return(self, method_name, *args, **kwargs):
            """
            The same as `map_method` but additionally reports the list of returned
            values and optionally deepcopies the passed arguments
    
    
    Severity: Minor
    Found in avocado/core/extension_manager.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 a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, namespace, invoke_kwds=None):
            super().__init__(namespace, invoke_kwds)
            namespace = f"{self.settings_section()}.order"
            configured_order = settings.as_dict().get(namespace)
            ordered = []
    Severity: Minor
    Found in avocado/core/enabled_extension_manager.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 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(
            self,
            methodName="test",
            name=None,
            params=None,
    Severity: Minor
    Found in avocado/core/test.py - About 1 hr to fix

      Function reserve_slot has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def reserve_slot(self, runtime_task):
              """
              Reserve a free or custom remote host slot for the runtime task.
      
              :param runtime_task: runtime task to reserve the slot for
      Severity: Minor
      Found in optional_plugins/spawner_remote/avocado_spawner_remote/__init__.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 resolve has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def resolve(reference):  # pylint: disable=W0221
      
              if GO_BIN is None:
                  return ReferenceResolution(
                      reference,
      Severity: Minor
      Found in optional_plugins/golang/avocado_golang/golang.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 tests has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def tests(self):
              mapping = {
                  "SKIP": "warning",
                  "ERROR": "danger",
                  "FAIL": "danger",
      Severity: Minor
      Found in optional_plugins/html/avocado_result_html/__init__.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 uncover_combination has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def uncover_combination(self, row, parameters):
              """
              Uncover combination of specific parameters by one row from possible solution
      
              :param row: one row from solution

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

          def cover_combination(self, row, parameters):
              """
              Cover combination of specific parameters by one row from possible solution
      
              :param row: one row from solution

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

          def is_valid_combination(self, row, parameters):
              """
              Is the specific parameters from solution row match the constraints.
      
              :param row: one row from solution

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

          def name_for_file_contains(self):
              """
              Get the distro if the :attr:`CHECK_FILE` is set and has content
              """
              if self.check_name_for_file_contains():
      Severity: Minor
      Found in avocado/utils/distro.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_mountpoint has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_mountpoint(self, filename=None):
              """
              Find the mount point of this partition object.
      
              :param filename: where to look for the mounted partitions information
      Severity: Minor
      Found in avocado/utils/partition.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

      Severity
      Category
      Status
      Source
      Language