avocado-framework/avocado

View on GitHub

Showing 489 of 903 total issues

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

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

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

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

        def __init__(self, uid, name, variant=None, no_digits=None):
            """
            Constructs a TestID instance
    
            :param uid: unique test id (within the job)
    Severity: Minor
    Found in avocado/core/test_id.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 discover has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def discover(self):
            resolutions = []
            for ext in self.extensions:
                try:
                    results = ext.obj.discover()
    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 _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

    Avoid deeply nested control flow statements.
    Open

                        if key in result:
                            result[key].add(val)
                        else:
                            result[key] = {val}
                    else:
    Severity: Major
    Found in avocado/core/safeloader/docstring.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 cleanup has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def cleanup(self):
                """
                Cleanup the temporary job handlers (dirs, global setting, ...)
                """
                self.__stop_job_logging()
        Severity: Minor
        Found in avocado/core/job.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_file has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

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

              def start(self):
                  """Log all collectibles at the start of the event."""
                  os.environ["AVOCADO_SYSINFODIR"] = self.pre_dir
                  for log_hook in self.start_collectibles:
                      # log daemons in profile directory
          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 _examine_class has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _examine_class(
          Severity: Minor
          Found in avocado/core/safeloader/core.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    async with self._state_machine.lock:
                                        self._state_machine.triaging.append(runtime_task)
                                        runtime_task.status = RuntimeTaskStatus.WAIT
                                        await asyncio.sleep(0.1)
                                    return
            Severity: Major
            Found in avocado/core/task/statemachine.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 from_config has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def from_config(cls, config, name=None, job_config=None):
                        """Helper method to create a TestSuite from config dicts.
                
                        This is different from the TestSuite() initialization because here we
                        are assuming that you need some help to build the test suite. Avocado
                Severity: Minor
                Found in avocado/core/suite.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 find_free_port has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def find_free_port(
                Severity: Minor
                Found in avocado/utils/network/ports.py - About 45 mins to fix

                  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

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

                        def get_tasks_in_topological_order(self):
                            """Computes the topological order of runtime tasks in graph
                    
                            :returns: runtime tasks in topological order
                            :rtype: list
                    Severity: Minor
                    Found in avocado/core/task/runtime.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 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

                    Avoid deeply nested control flow statements.
                    Open

                                            if m.group(2).upper().startswith("SKIP"):
                                                if count > 0:
                                                    yield self.Error("invalid SKIP directive for plan")
                                                skipped = True
                                            else:
                    Severity: Major
                    Found in avocado/core/tapparser.py - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language