oplik0/cherrydoor

View on GitHub
cherrydoor/cli/update.py

Summary

Maintainability
A
3 hrs
Test Coverage

Function update has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

def update(args, config={}):
    if config == {}:
        config = load_config(args)[0]
    previous_version = parse_version(
        import_module("cherrydoor.__version__").__version__
Severity: Minor
Found in cherrydoor/cli/update.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

Refactor this function to reduce its Cognitive Complexity from 24 to the 15 allowed.
Open

def update(args, config={}):
Severity: Critical
Found in cherrydoor/cli/update.py by sonar-python

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

There are no issues that match your filters.

Category
Status