wikimedia/pywikibot

View on GitHub
pywikibot/tools/_deprecate.py

Summary

Maintainability
C
1 day
Test Coverage

Function deprecated_args has a Cognitive Complexity of 40 (exceeds 10 allowed). Consider refactoring.
Open

def deprecated_args(**arg_pairs):
    """Decorator to declare multiple args deprecated.

    Usage:

Severity: Minor
Found in pywikibot/tools/_deprecate.py - About 5 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 deprecated has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring.
Open

def deprecated(*args, **kwargs):
    """Decorator to output a deprecation warning.

    .. versionchanged:: 7.0
       `since` keyword must be a release number, not a timestamp.
Severity: Minor
Found in pywikibot/tools/_deprecate.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 add_deprecated_attr has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
Open

    def add_deprecated_attr(self, name: str, replacement: Any = None, *,
                            replacement_name: str | None = None,
                            warning_message: str | None = None,
                            since: str = '',
                            future_warning: bool = True):
Severity: Minor
Found in pywikibot/tools/_deprecate.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 redirect_func has 8 arguments (exceeds 7 allowed). Consider refactoring.
Open

def redirect_func(target, *,
Severity: Major
Found in pywikibot/tools/_deprecate.py - About 35 mins to fix

    There are no issues that match your filters.

    Category
    Status