avocado-framework/avocado

View on GitHub

Showing 494 of 703 total issues

Function _examine_class has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

def _examine_class(
    target_module, target_class, determine_match, path, class_name, match
):
    """
    Examine a class from a given path
Severity: Minor
Found in avocado/core/safeloader/core.py - About 5 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 distro.py has 389 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/utils/distro.py - About 5 hrs to fix

    Function merge has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        def merge(self, other):
            """
            Merges `other` node into this one without checking the name of the
            other node. New values are appended, existing values overwritten
            and unaffected ones are kept. Then all other node children are

    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 diff.py has 377 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/diff.py - About 5 hrs to fix

      File disk.py has 376 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/utils/disk.py - About 5 hrs to fix

        File output_check.py has 374 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/output_check.py - About 5 hrs to fix

          File core.py has 368 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import ast
          import collections
          import sys
          from importlib.machinery import PathFinder
          
          
          Severity: Minor
          Found in avocado/core/safeloader/core.py - About 4 hrs to fix

            Function factory has 120 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              var factory = function( $, DataTable ) {
                "use strict";
            
            
                /* Set the defaults for DataTables initialisation */

              File memory.py has 364 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/utils/memory.py - About 4 hrs to fix

                ArchiveTest has 36 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class ArchiveTest(unittest.TestCase):
                    def setUp(self):
                        prefix = temp_dir_prefix(self)
                        self.basedir = tempfile.TemporaryDirectory(prefix=prefix)
                        self.compressdir = tempfile.mkdtemp(dir=self.basedir.name)
                Severity: Minor
                Found in selftests/unit/utils/archive.py - About 4 hrs to fix

                  TapParserTests has 36 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class TapParserTests(unittest.TestCase):
                      def assert_test(self, events, **kwargs):
                          if "explanation" not in kwargs:
                              kwargs["explanation"] = None
                          self.assertEqual(next(events), TapParser.Test(**kwargs))
                  Severity: Minor
                  Found in selftests/unit/tap.py - About 4 hrs to fix

                    Function makeState has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def makeState(self, state, sym):
                            assert sym is not None
                            #
                            #  Compute \epsilon-kernel state's core and see if
                            #  it exists already.
                    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 plugin_interfaces.py has 357 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/core/plugin_interfaces.py - About 4 hrs to fix

                      File job.py has 356 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import logging
                      import os
                      import tempfile
                      import unittest.mock
                      
                      
                      Severity: Minor
                      Found in selftests/unit/job.py - About 4 hrs to fix

                        File multipath.py has 353 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/utils/multipath.py - About 4 hrs to fix

                          Function clean_hash_table has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def clean_hash_table(self, combination_matrix, t_value):
                                  for constraint in self.constraints:
                                      if len(constraint) > t_value:
                                          continue
                                      parameters_in_constraint = []
                          Severity: Minor
                          Found in optional_plugins/varianter_cit/avocado_varianter_cit/Solver.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 simplify_constraints has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def simplify_constraints(self):
                                  items_to_remove = set()
                                  copy = list(self.constraints.copy())
                                  for i in range(len(copy)):
                                      is_brake = False
                          Severity: Minor
                          Found in optional_plugins/varianter_cit/avocado_varianter_cit/Solver.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 makeSet has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def makeSet(self, token, sets, i):
                                  cur, next_item = sets[i], sets[i + 1]
                          
                                  ttype = (  # pylint: disable=R1709
                                      token is not None and self.typestring(token) or None
                          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

                          Function compare_matrices has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def compare_matrices(matrix1, matrix2, threshold=0.05):
                              """
                              Compare 2 matrices nxm and return a matrix nxm with comparison data and
                              stats. When the first columns match, they are considered as header and
                              included in the results intact.
                          Severity: Minor
                          Found in avocado/utils/data_structures.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 sys_v_init_result_parser has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def sys_v_init_result_parser(command):
                              """
                              Parse results from sys_v style commands.
                          
                              command status: return true if service is running.
                          Severity: Minor
                          Found in avocado/utils/service.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

                          Severity
                          Category
                          Status
                          Source
                          Language