wikimedia/pywikibot

View on GitHub
scripts/delete.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function main has a Cognitive Complexity of 34 (exceeds 10 allowed). Consider refactoring.
Open

def main(*args: str) -> None:
    """Process command line arguments and invoke bot.

    If args is an empty list, sys.argv is used.

Severity: Minor
Found in scripts/delete.py - About 4 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 treat_page has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
Open

    def treat_page(self) -> None:
        """Process one page from the generator."""
        if self.opt.undelete:
            self.current_page.undelete(self.summary)
            self.counter['undelete'] += 1
Severity: Minor
Found in scripts/delete.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 display_references has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
Open

    def display_references(self) -> None:
        """
        Display pages that link to the current page, sorted per namespace.

        Number of pages to display per namespace is provided by:
Severity: Minor
Found in scripts/delete.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

There are no issues that match your filters.

Category
Status