avocado-framework/avocado

View on GitHub

Showing 490 of 907 total issues

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

def find_python_tests(target_module, target_class, determine_match, path):
    """
    Attempts to find Python tests from source files

    A Python test in this context is a method within a specific type
Severity: Minor
Found in avocado/core/safeloader/core.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 sysinfo.py has 309 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/sysinfo.py - About 3 hrs to fix

    JobTest has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class JobTest(unittest.TestCase):
        def setUp(self):
            self.job = None
            prefix = temp_dir_prefix(self)
            self.tmpdir = tempfile.TemporaryDirectory(prefix=prefix)
    Severity: Minor
    Found in selftests/unit/job.py - About 3 hrs to fix

      Test has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Test(unittest.TestCase, TestData):
          """
          Base implementation for the test class.
      
          You'll inherit from this to write your own tests. Typically you'll want
      Severity: Minor
      Found in avocado/core/test.py - About 3 hrs to fix

        File assets.py has 305 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """
        Assets plugin functional tests
        """
        
        import os
        Severity: Minor
        Found in selftests/functional/plugin/assets.py - About 3 hrs to fix

          File varianter.py has 304 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/varianter.py - About 3 hrs to fix

            Function set_idle_state has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

            def set_idle_state(state_number="all", disable=True, setstate=None):
                """
                Set/Reset cpu idle states for all cpus.
            
                :param state_number: cpuidle state number, default: `all` all states
            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

            File Cit.py has 299 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import logging
            import random
            
            from avocado_varianter_cit.CombinationMatrix import CombinationMatrix
            from avocado_varianter_cit.Solver import Solver
            Severity: Minor
            Found in optional_plugins/varianter_cit/avocado_varianter_cit/Cit.py - About 3 hrs to fix

              File data_structures.py has 298 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/data_structures.py - About 3 hrs to fix

                File data_dir.py has 297 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/data_dir.py - About 3 hrs to fix

                  Function get_arch has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def get_arch():
                      """Work out which CPU architecture we're running on."""
                      cpu_table = [
                          (b"^cpu.*(RS64|Broadband Engine)", "powerpc"),
                          (rb"^cpu.*POWER\d+", "powerpc"),
                  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

                  Function bootstrap has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) {
                        var api     = new DataTable.Api( settings );
                        var classes = settings.oClasses;
                        var lang    = settings.oLanguage.oPaginate;
                        var btnDisplay, btnClass;

                    File nvme.py has 295 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/nvme.py - About 3 hrs to fix

                      File archive.py has 293 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/archive.py - About 3 hrs to fix

                        Function ResizeControl has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function ResizeControl(table) {
                            var tableBorderSize = table.outerWidth() - table.innerWidth();
                            this.resizeData = {
                              isResizing: false,
                              mouseDownFired: false
                        Severity: Major
                        Found in optional_plugins/html/avocado_result_html/templates/avocado_html.js - About 3 hrs to fix

                          File __init__.py has 291 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 optional_plugins/html/avocado_result_html/__init__.py - About 3 hrs to fix

                            File sqlite.py has 289 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/dependencies/requirements/cache/backends/sqlite.py - About 2 hrs to fix

                              Function _get_test_variants has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def _get_test_variants(self):
                                      def add_variant(runnable, variant):
                                          runnable = deepcopy(runnable)
                                          runnable.variant = dump_variant(variant)
                                          runnable_with_variant.append(runnable)
                              Severity: Minor
                              Found in avocado/core/suite.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_docstring_directives_tags has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def get_docstring_directives_tags(docstring):
                                  """
                                  Returns the test categories based on a `:avocado: tags=category`
                                  docstring
                              
                              
                              Severity: Minor
                              Found in avocado/core/safeloader/docstring.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 gdbmi_parser.py has 287 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              #
                              # Copyright (c) 2008 Michael Eddington
                              #
                              # Permission is hereby granted, free of charge, to any person obtaining a copy
                              # of this software and associated documentation files (the "Software"), to deal
                              Severity: Minor
                              Found in avocado/utils/external/gdbmi_parser.py - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language