pyarmory/pike

View on GitHub

Showing 4 of 9 total issues

Function _child_modules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _child_modules(module):
    package_path = os.path.dirname(inspect.getabsfile(module))

    # Import all child modules
    for module_path in filesystem.find_modules(package_path):
Severity: Minor
Found in pike/discovery/py.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_import_filename has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_import_filename(self, module_path):
        for base_path in self.paths:
            target_path = os.path.join(base_path, module_path)
            is_pkg = os.path.isdir(target_path)

Severity: Minor
Found in pike/finder.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 find_modules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def find_modules(path):
    """Finds all modules located on a path"""
    for pathname in os.listdir(path):
        if pathname in EXCLUDED_MODULE_NAMES:
            continue
Severity: Minor
Found in pike/discovery/filesystem.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 get_child_modules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_child_modules(module, recursive=True):
    """Retrieve child modules

    :param module module: Module to search under
    :param bool recursive: Toggles the retrieval of sub-children module.
Severity: Minor
Found in pike/discovery/py.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