avocado-framework/avocado

View on GitHub

Showing 489 of 902 total issues

File requirements.py has 284 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import glob
import os

from avocado import Test, skipUnless
from avocado.core import exit_codes
Severity: Minor
Found in selftests/functional/serial/requirements.py - About 2 hrs to fix

    Function perform_setup has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def perform_setup(self, packages, no_dependencies=False):
            """
            General RPM setup with automatic handling of dependencies based on
            install attempts.
    
    
    Severity: Minor
    Found in avocado/utils/software_manager/backends/rpm.py - About 2 hrs 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

    File skiptests.py has 281 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import json
    import os
    import unittest
    
    from avocado.core import exit_codes
    Severity: Minor
    Found in selftests/functional/skiptests.py - About 2 hrs to fix

      Function attach has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            var attach = function( container, buttons ) {
              var i, ien, node, button;
              var clickHandler = function ( e ) {
                e.preventDefault();
                if ( !$(e.currentTarget).hasClass('disabled') ) {

        PMem has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class PMem:
            """
            PMem class which provides function to perform ndctl and daxctl operations
        
            This class can be used only if ndctl binaries are provided before hand
        Severity: Minor
        Found in avocado/utils/pmem.py - About 2 hrs to fix

          File service.py has 276 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          #  Copyright(c) 2013 Intel Corporation.
          #
          #  This program is free software; you can redistribute it and/or modify it
          #  under the terms and conditions of the GNU General Public License,
          #  version 2, as published by the Free Software Foundation.
          Severity: Minor
          Found in selftests/unit/utils/service.py - About 2 hrs to fix

            Function n_tuple has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def n_tuple(node):
                    if len(node) == 2:
                        # tuple ::= {}
                        node.value = {}
                    elif len(node) == 3:
            Severity: Minor
            Found in avocado/utils/external/gdbmi_parser.py - About 2 hrs 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

            TreeNode has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class TreeNode:
                """
                Class for bounding nodes into tree-structure.
                """
            
            
            Severity: Minor
            Found in avocado/core/tree.py - About 2 hrs to fix

              Function create_suites has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

              def create_suites(args):  # pylint: disable=W0621
                  suites = []
                  config_check = {"run.ignore_missing_references": True}
              
                  if args.dict_tests["static-checks"]:
              Severity: Minor
              Found in selftests/check.py - About 2 hrs 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 _monitor has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _monitor(proc, time_started, queue):
                      timeout = float("inf")
                      next_status_time = None
                      while True:
                          time.sleep(RUNNER_RUN_CHECK_INTERVAL)
              Severity: Minor
              Found in avocado/plugins/runners/avocado_instrumented.py - About 2 hrs 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 _update_zip_extra_attrs has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _update_zip_extra_attrs(self, dst_dir):
                      if platform.system() != "Linux":
                          LOG.warning("Attr handling in zip files only supported on Linux.")
                          return
                      # Walk all files and re-create files as symlinks
              Severity: Minor
              Found in avocado/utils/archive.py - About 2 hrs 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 makeNewRules has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  def makeNewRules(self):
                      worklist = []
                      for rulelist in self.rules.values():
                          for rule in rulelist:
                              worklist.append((rule, 0, 1, rule))
              Severity: Minor
              Found in avocado/utils/external/spark.py - About 2 hrs 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 __enter__ has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __enter__(self):
                      flags = os.O_CREAT | os.O_EXCL | os.O_WRONLY | os.O_SYNC
                      timelimit = time.monotonic() + self.timeout
                      while True:
                          try:
              Severity: Minor
              Found in avocado/utils/filelock.py - About 2 hrs 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

              File nrunner.py has 265 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import os
              import sys
              import time
              import unittest
              
              
              Severity: Minor
              Found in selftests/functional/nrunner.py - About 2 hrs to fix

                Function run has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    def run(self, config):
                        for plugin_dispatcher, config_needed, job_needed in itertools.chain(
                            dispatcher.get_dispatchers("avocado.core.dispatcher"),
                            dispatcher.get_dispatchers("avocado.core.resolver"),
                        ):
                Severity: Minor
                Found in avocado/plugins/plugins.py - About 2 hrs 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 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    def run(self, config):
                        tree = config.get("variants.tree")
                        summary = config.get("variants.summary")
                        variants = config.get("variants.variants")
                        contents = config.get("variants.contents")
                Severity: Minor
                Found in avocado/plugins/variants.py - About 2 hrs 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 _no_test_in_process_table has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _no_test_in_process_table(self):
                        """
                        Make sure the test will be really gone from the
                        process table.
                        """
                Severity: Minor
                Found in selftests/functional/interrupt.py - About 2 hrs 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 recursive_compare_dict has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                def recursive_compare_dict(dict1, dict2, level="DictKey", diff_btw_dict=None):
                    """
                    Difference between two dictionaries are returned
                    Dict values can be a dictionary, list and value
                
                
                Severity: Minor
                Found in avocado/utils/data_structures.py - About 2 hrs 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_data has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_data(self, filename, source=None, must_exist=True):
                        """
                        Retrieves the path to a given data file.
                
                        This implementation looks for data file in one of the sources
                Severity: Minor
                Found in avocado/core/test.py - About 2 hrs 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

                File job_timeout.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import glob
                import os
                import tempfile
                import unittest
                import xml.dom.minidom
                Severity: Minor
                Found in selftests/functional/job_timeout.py - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language