avocado-framework/avocado

View on GitHub

Showing 488 of 901 total issues

Function main has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

def main(args):  # pylint: disable=W0621

    args.dict_tests = {
        "static-checks": False,
        "job-api": False,
Severity: Minor
Found in selftests/check.py - About 7 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 cpu.py has 494 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/cpu.py - About 7 hrs to fix

    File pci.py has 472 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/pci.py - About 7 hrs to fix

      File assets.py has 470 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/assets.py - About 7 hrs to fix

        File vmimage.py has 463 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import unittest.mock
        from urllib.error import HTTPError
        
        from avocado.utils import vmimage
        from selftests.utils import setup_avocado_loggers
        Severity: Minor
        Found in selftests/unit/utils/vmimage.py - About 7 hrs to fix

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

              def run(self, config):
                  def _get_name(test):
                      return str(test["id"])
          
                  def _get_name_no_id(test):
          Severity: Minor
          Found in avocado/plugins/diff.py - About 7 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 461 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import os
          import sys
          import tempfile
          import unittest.mock
          
          
          Severity: Minor
          Found in selftests/unit/nrunner.py - About 7 hrs to fix

            File tree.py has 459 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/tree.py - About 7 hrs to fix

              Function vg_ramdisk_cleanup has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
              Open

              def vg_ramdisk_cleanup(
                  ramdisk_filename=None,
                  vg_ramdisk_dir=None,
                  vg_name=None,
                  loop_device=None,
              Severity: Minor
              Found in avocado/utils/lv_utils.py - About 6 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 pmem.py has 439 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/pmem.py - About 6 hrs to fix

                File podman.py has 437 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import asyncio
                import json
                import logging
                import os
                import re
                Severity: Minor
                Found in avocado/plugins/spawners/podman.py - About 6 hrs to fix

                  File statemachine.py has 433 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import asyncio
                  import collections
                  import logging
                  import multiprocessing
                  import time
                  Severity: Minor
                  Found in avocado/core/task/statemachine.py - About 6 hrs to fix

                    Function parse has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def parse(file_object):
                            """
                            Parsing of input file with parameters and constraints
                    
                            :param file_object: input file for parsing
                    Severity: Minor
                    Found in optional_plugins/varianter_cit/avocado_varianter_cit/Parser.py - About 6 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 main has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def main():
                        exitcode = exit_codes.UTILITY_OK
                        parser = argparse.ArgumentParser(
                            "install|remove|check-installed|list-all|list-files|add-repo|"
                            "remove-repo|upgrade|what-provides|install-what-provides arguments"
                    Severity: Minor
                    Found in avocado/utils/software_manager/main.py - About 6 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 save has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def save(self, ipaddr, netmask):
                            """Save current interface IP Address to the system configuration file.
                    
                            If the ipaddr is valid (currently being used by the interface)
                            this will try to save the current settings into /etc/. This
                    Severity: Minor
                    Found in avocado/utils/network/interfaces.py - About 6 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 runnable.py has 420 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import base64
                    import collections
                    import json
                    import logging
                    import subprocess
                    Severity: Minor
                    Found in avocado/core/nrunner/runnable.py - About 6 hrs to fix

                      File varianter_yaml_to_mux.py has 418 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.
                      #

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

                          File setup.py has 411 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          #!/bin/env python3
                          # 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 setup.py - About 5 hrs to fix

                            Function filter_tags_on_runnables has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def filter_tags_on_runnables(
                                resolutions, filter_by_tags, include_empty=False, include_empty_key=False
                            ):
                                """
                                Filters out runnables that do not match the tags criteria given
                            Severity: Minor
                            Found in avocado/core/tags.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

                            Severity
                            Category
                            Status
                            Source
                            Language