avocado-framework/avocado

View on GitHub

Showing 489 of 902 total issues

Avoid too many return statements within this function.
Open

                    return ""
Severity: Major
Found in avocado/utils/software_manager/backends/yum.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return True
    Severity: Major
    Found in avocado/utils/network/interfaces.py - About 30 mins to fix

      Function _run_unittest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _run_unittest(cls, module_path, module_class_method, queue):
              sys.path.insert(0, module_path)
              stream = io.StringIO()
      
              try:
      Severity: Minor
      Found in avocado/plugins/runners/python_unittest.py - About 25 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 _check_output has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _check_output(self, path, exps):
              i = 0
              end = len(exps)
              with open(path, "rb") as output_file:  # pylint: disable=W1514
                  output_file_content = output_file.read()
      Severity: Minor
      Found in selftests/functional/output.py - About 25 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 create_from_yaml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def create_from_yaml(paths):
          """Create tree structure from yaml-like file.
      
          :param paths: File object to be processed
          :raise SyntaxError: When yaml-file is corrupted

      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 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def end_test(self, result, state):
              if not self.owns_stdout:
                  return
              status = state.get("status", "ERROR")
              if status in self.omit_statuses:
      Severity: Minor
      Found in avocado/plugins/human.py - About 25 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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self, runnable):
              # pylint: disable=W0201
              self.runnable = runnable
              error_msgs = []
              if not GO_BIN:
      Severity: Minor
      Found in optional_plugins/golang/avocado_golang/runner.py - About 25 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_one_job_results has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_one_job_results(path, results):
          with open(path, encoding="utf-8") as result_json:
              js = json.load(result_json)
      
          job = {}
      Severity: Minor
      Found in contrib/scripts/summarize-job-failures.py - About 25 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 _cdiff has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _cdiff(self, diff):
              for line in diff:
                  if line.startswith("+"):
                      yield self.term.COLOR_GREEN + line
                  elif line.startswith("-"):
      Severity: Minor
      Found in avocado/plugins/diff.py - About 25 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 _create_test_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _create_test_files(self, urlopen_mock):
              with unittest.mock.patch("avocado.core.data_dir.settings", self.stg):
                  expected_images = [
                      {
                          "name": "Fedora",
      Severity: Minor
      Found in selftests/unit/plugin/vmimage.py - About 25 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 compute_hamming_distance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def compute_hamming_distance(self, row):
              """
              :return: hamming distance of row from final matrix
              """
              distance = 0
      Severity: Minor
      Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py - About 25 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 _render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _render(result):
              tests = []
              for test in result.tests:
                  fail_reason = test.get("fail_reason", UNKNOWN)
                  if fail_reason is not None:
      Severity: Minor
      Found in avocado/plugins/jsonresult.py - About 25 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_packages_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_packages_info(self):
              """
              This method will go through each file, checking if it's a valid
              software package file by calling :meth:`is_software_package` and
              calling :meth:`load_package_info` if it's so.
      Severity: Minor
      Found in avocado/plugins/distro.py - About 25 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 _create_failure_or_error has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _create_failure_or_error(self, document, test, element_type, max_log_size=None):
              element = document.createElement(element_type)
              element.setAttribute("type", self._get_attr(test, "fail_class"))
              element.setAttribute("message", self._get_attr(test, "fail_reason"))
              traceback_content = self._escape_cdata(test.get("traceback", self.UNKNOWN))
      Severity: Minor
      Found in avocado/plugins/xunit.py - About 25 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 assert_change has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def assert_change(actual_result, expected_result):
          """
          Condition wrapper of the upper method.
      
          :param actual_result: actual added and removed lines with filepath keys and a tuple of
      Severity: Minor
      Found in avocado/utils/diff_validator.py - About 25 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 destroy_namespace has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def destroy_namespace(self, namespace="all", region="", bus="", force=False):
              """
              Destroy namespaces, skipped in case of legacy namespace
      
              :param namespace: name of the namespace to be destroyed
      Severity: Minor
      Found in avocado/utils/pmem.py - About 25 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 add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def add(self, input_set, item, i=None, predecessor=None, causal=None):
              if predecessor is None:
                  if item not in input_set:
                      input_set.append(item)
              else:
      Severity: Minor
      Found in avocado/utils/external/spark.py - About 25 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_source has a Cognitive Complexity of 6 (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/zypper.py - About 25 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 parse_lsmod_for_module has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def parse_lsmod_for_module(l_raw, module_name, escape=True):
          """
          Use a regex to parse raw lsmod output and get module information
          :param l_raw: raw output of lsmod
          :type l_raw:  str
      Severity: Minor
      Found in avocado/utils/linux_modules.py - About 25 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 convert_systemd_target_to_runlevel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def convert_systemd_target_to_runlevel(target):
          """
          Convert systemd target to runlevel.
      
          :param target: systemd target
      Severity: Minor
      Found in avocado/utils/service.py - About 25 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

      Severity
      Category
      Status
      Source
      Language