avocado-framework/avocado

View on GitHub

Showing 489 of 902 total issues

File app.py has 257 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import argparse
import inspect
import json
import os
import re
Severity: Minor
Found in avocado/core/nrunner/app.py - About 2 hrs to fix

    DocstringDirectives has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DocstringDirectives(unittest.TestCase):
    
        VALID_DIRECTIVES = [
            ":avocado: foo",
            " :avocado: foo",
    Severity: Minor
    Found in selftests/unit/safeloader_docstring.py - About 2 hrs to fix

      TestSuite has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class TestSuite:
          def __init__(
              self,
              name,
              config=None,
      Severity: Minor
      Found in avocado/core/suite.py - About 2 hrs to fix

        File run.py has 256 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/run.py - About 2 hrs to fix

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

              def run(self, runnable):
                  # pylint: disable=W0201
                  self.runnable = runnable
                  try:
                      yield messages.StartedMessage.get()
          Severity: Minor
          Found in avocado/plugins/runners/python_unittest.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_possible_values has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_possible_values(self, row, parameter):
                  """
                  Compute all possible values for the given parameter.
          
                  These values are based on constraints and already picked values
          Severity: Minor
          Found in optional_plugins/varianter_cit/avocado_varianter_cit/Solver.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 initialize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              def initialize(self, config):
                  subcommand = config.get("subcommand")
                  data = None
          
                  # Merge the multiplex

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

          def create_diff_report(change_diffs):
              """
              Pretty prints the output of the `change_diffs` variable.
          
              :param change_diffs: detected differences as groups of lines with filepath keys and a tuple of
          Severity: Minor
          Found in avocado/utils/diff_validator.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 systemd_result_parser has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          def systemd_result_parser(command):
              """
              Parse results from systemd style commands.
          
              command status: return true if service is running.
          Severity: Minor
          Found in avocado/utils/service.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_ns_status has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_ns_status(controller_name, ns_id):
              """
              Returns the status of namespaces on the specified controller
          
              :param controller_name: name of the controller like nvme0
          Severity: Minor
          Found in avocado/utils/nvme.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 process_node has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              def process_node(node):
                  """
                  Generate this node's tree-view
                  :return: list of lines
                  """
          Severity: Minor
          Found in avocado/core/tree.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 _must_key_val_matches has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          def _must_key_val_matches(must_key_vals, test_tags, include_empty_key):
              """
              Checks if the required key:vals are fulfilled by the test_tags
          
              :rtype: bool
          Severity: Minor
          Found in avocado/core/tags.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 list.py has 253 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import json
          import os
          import signal
          import stat
          import subprocess
          Severity: Minor
          Found in selftests/functional/list.py - About 2 hrs to fix

            File sysinfo.py has 253 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/sysinfo.py - About 2 hrs to fix

              File requirements.py has 253 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

                File yum.py has 253 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import configparser
                import logging
                import os
                import re
                import shutil
                Severity: Minor
                Found in avocado/utils/software_manager/backends/yum.py - About 2 hrs to fix

                  File partition.py has 251 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/partition.py - About 2 hrs to fix

                    Function __init__ has 16 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(
                    Severity: Major
                    Found in avocado/core/settings.py - About 2 hrs to fix

                      Function register_option has 16 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def register_option(
                      Severity: Major
                      Found in avocado/core/settings.py - About 2 hrs to fix

                        Function file_has_content has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def file_has_content(file_path, content, regex):
                                """Check if a file has `content`."""
                                if os.path.isfile(file_path):
                                    with open(file_path, "r", encoding="utf-8") as f:
                                        lines = f.readlines()
                        Severity: Minor
                        Found in selftests/check.py - About 1 hr 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