avocado-framework/avocado

View on GitHub

Showing 685 of 703 total issues

Avoid deeply nested control flow statements.
Open

                        if nk is not None:
                            # self.add(cur, (nk, i))
                            # INLINED --v
                            new = (nk, i)
                            if new not in cur:
Severity: Major
Found in avocado/utils/external/spark.py - About 45 mins to fix

    Function provides has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def provides(self, name):
            """
            Searches for what provides a given file.
    
            :param name: File path.
    Severity: Minor
    Found in avocado/utils/software_manager/backends/zypper.py - About 45 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_distro has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_distro(self):
            """
            :param session: ssh connection between another machine
    
            Returns the :class:`LinuxDistro` this probe detected
    Severity: Minor
    Found in avocado/utils/distro.py - About 45 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 _namelist has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def _namelist(instance):
        namelist, namedict, classlist = [], {}, [instance.__class__]
        for c in classlist:
            for b in c.__bases__:
                classlist.append(b)  # pylint: disable=W4701
    Severity: Minor
    Found in avocado/utils/external/spark.py - About 45 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 tokenize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def tokenize(self, s):
            pos = 0
            n = len(s)
            while pos < n:
                m = self.re.match(s, pos)
    Severity: Minor
    Found in avocado/utils/external/spark.py - About 45 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

    Avoid deeply nested control flow statements.
    Open

                            if new not in cur:
                                self.links[key] = []
                                cur.append(new)
                            self.links[key].append((pptr, why))
    Severity: Major
    Found in avocado/utils/external/spark.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if param_type is not None:
                              param_dic["type"] = param_type.group(1)
                          param_list.append(param_dic)
      Severity: Major
      Found in avocado/utils/linux_modules.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if nk is not None:
                                    self.add(cur, (nk, i))
        
        
        Severity: Major
        Found in avocado/utils/external/spark.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if new not in next_item:
                                      next_item.append(new)
                                  # INLINED --^
                      else:
          Severity: Major
          Found in avocado/utils/external/spark.py - About 45 mins to fix

            Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def render(self, result, job):
                    xunit_enabled = job.config.get("job.run.result.xunit.enabled")
                    xunit_output = job.config.get("job.run.result.xunit.output")
                    if not (xunit_enabled or xunit_output):
                        return
            Severity: Minor
            Found in avocado/plugins/xunit.py - About 45 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 lv_create has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def lv_create(
            Severity: Minor
            Found in avocado/utils/lv_utils.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if isinstance(metadata, dict):
                                      if metadata.get("type", None) == "vmimage":
                                          provider = None
                                          for p in vmimage.IMAGE_PROVIDERS:
                                              if p.name == metadata["name"]:
              Severity: Major
              Found in avocado/plugins/vmimage.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if paths["Address"] == pci_address:
                                        ns_list.append(namespace["NSID"])
                    return ns_list
                Severity: Major
                Found in avocado/utils/nvme.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if nk is not None:
                                              self.add(next_item, (nk, i + 1))
                  
                  
                  Severity: Major
                  Found in avocado/utils/external/spark.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if line.startswith(b"CPU architecture"):
                                            version = int(line.split(b":", 1)[1])
                                            if version >= 8:
                                                return "aarch64"
                                            else:
                    Severity: Major
                    Found in avocado/utils/cpu.py - About 45 mins to fix

                      Function make has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def make(
                      Severity: Minor
                      Found in avocado/utils/build.py - About 45 mins to fix

                        Function end has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def end(self, status=""):
                                """
                                Logging hook called whenever a job finishes.
                                """
                                optimized = self.config.get("sysinfo.collect.optimize")
                        Severity: Minor
                        Found in avocado/core/sysinfo.py - About 45 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 _extend_directory has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def _extend_directory(path):
                            if not os.path.isdir(path):
                                return [path]
                            paths = []
                            # no error handling so far
                        Severity: Minor
                        Found in avocado/core/resolver.py - About 45 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 unmount has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def unmount(self, force=True):
                                """
                                Umount this partition.
                        
                                It's easier said than done to umount a partition.
                        Severity: Minor
                        Found in avocado/utils/partition.py - About 45 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

                        Avoid deeply nested control flow statements.
                        Open

                                                if parts[1] == self.mountpoint:
                                                    return parts[1]  # The mountpoint where it's mounted
                                        return None
                        Severity: Major
                        Found in avocado/utils/partition.py - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language