avocado-framework/avocado

View on GitHub

Showing 490 of 907 total issues

File distro.py has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
Severity: Minor
Found in avocado/plugins/distro.py - About 4 hrs to fix

    Function _get_tap_result has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_tap_result(stdout):
            parser = TapParser(io.StringIO(stdout.decode()))
            result = ""
            fail_reason = None
            for event in parser.parse():
    Severity: Minor
    Found in avocado/plugins/runners/tap.py - About 4 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 compute_row has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        def compute_row(self):
            """
            Computation of one row which covers most of combinations
    
            :return: new solution row
    Severity: Minor
    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py - About 4 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 computeNull has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        def computeNull(self):
            self.nullable = {}  # pylint: disable=W0201
            tbd = []
    
            for rulelist in self.rules.values():
    Severity: Minor
    Found in avocado/utils/external/spark.py - About 4 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 tags.py has 333 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import os
    import stat
    import unittest
    
    from avocado.core import resolver, tags
    Severity: Minor
    Found in selftests/unit/tags.py - About 4 hrs to fix

      File runtime.py has 330 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import itertools
      import os
      from enum import Enum
      
      from avocado.core.dispatcher import TestPostDispatcher, TestPreDispatcher
      Severity: Minor
      Found in avocado/core/task/runtime.py - About 3 hrs to fix

        Function _skip_method_decorator has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

        def _skip_method_decorator(function, message, condition, negate):
            """Creates a skip decorator for a method."""
        
            @wraps(function)
            def wrapper(obj, *args, **kwargs):  # pylint: disable=W0613
        Severity: Minor
        Found in avocado/core/decorators.py - About 3 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 loaded_module_info has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

        def loaded_module_info(module_name):
            """
            Get loaded module details: Size and Submodules.
        
            :param module_name: Name of module to search for
        Severity: Minor
        Found in avocado/utils/linux_modules.py - About 3 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 install_distro_packages has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

        def install_distro_packages(distro_pkg_map, interactive=False):
            """
            Installs packages for the currently running distribution
        
            This utility function checks if the currently running distro is a
        Severity: Minor
        Found in avocado/utils/software_manager/distro_packages.py - About 3 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_test has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            def _run_test(self):
                """
                Auxiliary method to run setup and test method.
                """
                self._tag_start()
        Severity: Minor
        Found in avocado/core/test.py - About 3 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 safeloader_core.py has 321 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import os
        import sys
        import unittest
        import unittest.mock
        from collections import OrderedDict
        Severity: Minor
        Found in selftests/unit/safeloader_core.py - About 3 hrs to fix

          File runner_nrunner.py has 321 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # This program is free software; you can redistribute it and/or modify
          # it under the terms of the GNU General Public License as published by
          # the Free Software Foundation; either version 2 of the License, or
          # (at your option) any later version.
          #
          Severity: Minor
          Found in avocado/plugins/runner_nrunner.py - About 3 hrs to fix

            Cpu has 30 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Cpu(Test):
                @staticmethod
                def _get_file_mock(content):
                    file_mock = unittest.mock.Mock()
                    file_mock.__enter__ = unittest.mock.Mock(return_value=io.BytesIO(content))
            Severity: Minor
            Found in selftests/unit/utils/cpu.py - About 3 hrs to fix

              Runnable has 30 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Runnable:
                  """
                  Describes an entity that be executed in the context of a task
              
                  A instance of :class:`BaseRunner` is the entity that will actually
              Severity: Minor
              Found in avocado/core/nrunner/runnable.py - About 3 hrs to fix

                File mux.py has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # This program is free software; you can redistribute it and/or modify
                # it under the terms of the GNU General Public License as published by
                # the Free Software Foundation; either version 2 of the License, or
                # (at your option) any later version.
                #

                  Function _valid_variant has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _valid_variant(variant):
                          """
                          Check the variant for validity of internal filters
                  
                          :return: whether the variant is valid or should be ignored/filtered

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

                  def resolve(references, hint=None, ignore_missing=True, config=None):
                      resolutions = []
                      hint_resolutions = []
                      hint_references = {}
                  
                  
                  Severity: Minor
                  Found in avocado/core/resolver.py - About 3 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_family has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def get_family():
                      """Get family name of the cpu like Broadwell, Haswell, power8, power9."""
                      family = None
                      arch = get_arch()
                      if arch == "x86_64" or arch == "i386":
                  Severity: Minor
                  Found in avocado/utils/cpu.py - About 3 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

                  GenericParser has 29 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class GenericParser:
                      #
                      #  An Earley parser, as per J. Earley, "An Efficient Context-Free
                      #  Parsing Algorithm", CACM 13(2), pp. 94-102.  Also J. C. Earley,
                      #  "An Efficient Context-Free Parsing Algorithm", Ph.D. thesis,
                  Severity: Minor
                  Found in avocado/utils/external/spark.py - About 3 hrs to fix

                    Function to_str has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def to_str(self, summary, variants, **kwargs):
                            """
                            Return human readable representation
                    
                            The summary/variants accepts verbosity where 0 means silent and
                    Severity: Minor
                    Found in avocado/plugins/json_variants.py - About 3 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

                    Severity
                    Category
                    Status
                    Source
                    Language