Defelo/PyCrypCli

View on GitHub
PyCrypCli/commands/command.py

Summary

Maintainability
A
2 hrs
Test Coverage

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

def make_commands() -> dict[Type[Context], dict[str, Command]]:
    for module in [
        "account",
        "help",
        "shell",
Severity: Minor
Found in PyCrypCli/commands/command.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 make_subcommands has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def make_subcommands(self) -> None:
        for cmd in self.subcommands:
            for context in cmd.contexts:
                for name in [cmd.name] + cmd.aliases:
                    if name in self.prepared_subcommands.setdefault(context, {}):
Severity: Minor
Found in PyCrypCli/commands/command.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 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Minor
Found in PyCrypCli/commands/command.py - About 35 mins to fix

    There are no issues that match your filters.

    Category
    Status