avocado-framework/avocado

View on GitHub
avocado/core/settings.py

Summary

Maintainability
D
2 days
Test Coverage
A
90%

File settings.py has 506 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; specifically version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
Severity: Major
Found in avocado/core/settings.py - About 1 day to fix

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

        def register_option(self, section, key, default, help_msg, key_type=str,
    Severity: Major
    Found in avocado/core/settings.py - About 1 hr to fix

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

          def __init__(self, namespace, help_msg, key_type=str, default=None,
      Severity: Major
      Found in avocado/core/settings.py - About 1 hr to fix

        Function add_argparser_to_option has 12 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def add_argparser_to_option(self, namespace, parser, long_arg=None,
        Severity: Major
        Found in avocado/core/settings.py - About 1 hr to fix

          Function add_argparser has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def add_argparser(self, parser, long_arg, short_arg=None,
          Severity: Major
          Found in avocado/core/settings.py - About 1 hr to fix

            Function merge_with_arguments has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def merge_with_arguments(self, arg_parse_config):
                    """Merge the current settings with the command-line args.
            
                    After parsing argument options this method should be executed to have
                    an unified settings.
            Severity: Minor
            Found in avocado/core/settings.py - About 55 mins 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 arg_parse_args has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def arg_parse_args(self):
                    args = {'help': self.help_msg,
                            'default': None}
            
                    if self.nargs:
            Severity: Minor
            Found in avocado/core/settings.py - About 25 mins 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 set_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def set_value(self, value, convert=False):
                    dst_type = self.key_type
            
                    if convert is False:
                        self._value = value
            Severity: Minor
            Found in avocado/core/settings.py - About 25 mins 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

            There are no issues that match your filters.

            Category
            Status