avocado-framework/avocado

View on GitHub

Showing 490 of 907 total issues

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

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

    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

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

            def _create_connection(self):
                """
                Creates connection with `self.uri` based on `socket.create_connection`
                """
                if ":" in self.uri:
        Severity: Minor
        Found in avocado/core/nrunner/task.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 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 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 not must_flat.issubset(test_tags):
                                continue
        
        
        Severity: Major
        Found in avocado/core/tags.py - About 45 mins to fix

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

              def from_avocado_config(
          Severity: Minor
          Found in avocado/core/nrunner/runnable.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if not _must_key_val_matches(
                                    must_key_val, test_tags, include_empty_key
                                ):
                                    continue
            
            
            Severity: Major
            Found in avocado/core/tags.py - About 45 mins to fix

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

                  def merge_with_arguments(self, arg_parse_config):
                      """Merge the current settings with the command-line args.
              
                      After parsing argument options this method should be executed to have
                      an unified settings.
              Severity: Minor
              Found in avocado/core/settings.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

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

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

                    def emit(self, record):
                        try:
                            msg = self.format(record)
                            if record.levelno < logging.INFO:  # Most messages are INFO
                                pass
                Severity: Minor
                Found in avocado/core/output.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

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

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

                      def identifier(self):
                          """Runnable identifier respecting user's format string.
                  
                          This is still experimental and we have room for improvements.
                  
                  
                  Severity: Minor
                  Found in avocado/core/nrunner/runnable.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

                  Consider simplifying this complex logical expression.
                  Open

                          if len(line) > 2 and (line[:3] == "+++" or line[:3] == "---"):
                              continue
                          # ignore line range information in the output
                          elif len(line) > 1 and line[:2] == "@@":
                              continue
                  Severity: Major
                  Found in avocado/utils/diff_validator.py - About 40 mins to fix

                    Function test_send_signal_sudo_enabled_with_exception has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def test_send_signal_sudo_enabled_with_exception(
                    Severity: Minor
                    Found in selftests/unit/utils/process.py - About 35 mins to fix

                      Function test_send_signal_sudo_enabled has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def test_send_signal_sudo_enabled(self, run, get_children, get_pid, sudo, _):
                      Severity: Minor
                      Found in selftests/unit/utils/process.py - About 35 mins to fix

                        Function _test has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def _test(self, name, content, exp_str, mode=MODE_0664, count=1):
                        Severity: Minor
                        Found in selftests/functional/list.py - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language