SylvainDe/DidYouMean-Python

View on GitHub

Showing 142 of 142 total issues

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

def suggest_invalid_syntax(value, frame, groups):
    """Get suggestions in case of INVALID_SYNTAX error."""
    del frame, groups  # unused param
    alternatives = {
        '<>': '!=',
Severity: Minor
Found in didyoumean/didyoumean_internal.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 register_suggestion_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def register_suggestion_for(error_type, regex):
    """Decorator to register a function to be called to get suggestions.

    Parameters correspond to the fact that the registration is done for a
    specific error type and if the error message matches a given regex
Severity: Minor
Found in didyoumean/didyoumean_internal.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