stormrose-va/xobox

View on GitHub

Showing 16 of 28 total issues

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

def detect_class_modules(mod, parent=object):
    """
    Detect available class modules or packages and return a dictionary of valid
    class names, referring to the module they are contained within.
    
Severity: Minor
Found in xobox/utils/loader.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

Logger has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class Logger(object):
    """
    Class providing the output interface for various output channels. Currently,
    supported output channels are
    
Severity: Minor
Found in xobox/cli/logger.py - About 2 hrs to fix

Function _set_command has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def _set_command(self):
        """
        Split arguments into global and command specific ones
        and detect the command or alias
        """
Severity: Minor
Found in xobox/cli/dispatch.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 _assemble_args has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def _assemble_args(arguments, indent):
        """
        Assemble argument list with a given indentation
        """
        result = ""
Severity: Minor
Found in xobox/cli/dispatch.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 _assemble_options has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def _assemble_options(arguments):
        """
        Assemble options list from an arguments tuple
        """
        result = ""
Severity: Minor
Found in xobox/cli/dispatch.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

Function __init__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, *args, **kwargs):
        self._levels = Levels
        self._level = get_conf('DEFAULT_LOG_LEVEL')
        self._type = get_conf('DEFAULT_LOG_TYPE')
        self._logfile = get_conf('DEFAULT_LOG_FILE')
Severity: Minor
Found in xobox/cli/logger.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

Function get_version has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def get_version(*args, **kwargs):
    """
    Derives a `PEP 440`_ compliant version number from VERSION, assuming
    VERSION is a quintuple consisting of these elements::
    
Severity: Minor
Found in xobox/utils/version.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

Function execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def execute(self):
        """
        Based on the given command line arguments and the available subcommands,
        this method creates the appropriate command line parser and starts the
        corresponding subcommand.
Severity: Minor
Found in xobox/cli/dispatch.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

Function __get_candidates has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def __get_candidates(path, module_filter, member_filter):
    """
    Generate candidates from a given path
    
    :param str path:         location on the file system to scan
Severity: Minor
Found in scripts/runtest.py - About 45 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 log has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def log(self, level, message):
        """Register a log message within the logging queue"""
        # log usage messages only on a terminal
        if level == 'usage':
            if self._type == 'term':
Severity: Minor
Found in xobox/cli/logger.py - About 35 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 __write_untested has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def __write_untested(label, result):
    """
    Print information on non-executed tests

    :param str label: type of the untested (either 'Skipped' or 'Failed')
Severity: Minor
Found in scripts/runtest.py - About 35 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 get_development_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_development_status(*args, **kwargs):
    """
    Derive the development status compliant to `PEP 301 Trove Classifiers`_ from VERSION, assuming
    VERSION is a quintuple consisting of these elements::
    
Severity: Minor
Found in xobox/utils/version.py - About 35 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

Avoid too many return statements within this function.
Open

        return bytes(source=str(value), encoding=get_conf('DEFAULT_CHARSET'), errors='replace')
Severity: Major
Found in xobox/utils/convert.py - About 30 mins to fix

Function _get_commands has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_commands(self):
        """
        Detect available command modules or packages and their alias names
        """
        cmds = loader.detect_class_modules('xobox.cli.commands', BaseCommand)
Severity: Minor
Found in xobox/cli/dispatch.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 _update_from_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _update_from_file(self):
        """
        Update configuration with information from configuration file.
        
        Only values will be considered if the appropriate key has been defined in
Severity: Minor
Found in xobox/conf/__init__.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, decorated):
        self._decorated = decorated
        if hasattr(decorated, '__doc__'):
            self.__doc__ = decorated.__doc__
        if hasattr(decorated, '__module__'):
Severity: Minor
Found in xobox/utils/singleton.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

Severity
Category
Status
Source
Language