wikimedia/pywikibot

View on GitHub
pywikibot/page/_page.py

Summary

Maintainability
B
5 hrs
Test Coverage

Function templatesWithParams has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring.
Open

    def templatesWithParams(self):  # noqa: N802
        """Return templates used on this Page.

        The templates are extracted by :meth:`raw_extracted_templates`,
        with positional arguments placed first in order, and each named
Severity: Minor
Found in pywikibot/page/_page.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 get_best_claim has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
Open

    def get_best_claim(self, prop: str):
        """
        Return the first best Claim for this page.

        Return the first 'preferred' ranked Claim specified by Wikibase
Severity: Minor
Found in pywikibot/page/_page.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 set_redirect_target has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
Open

    def set_redirect_target(
        self,
        target_page,
        create: bool = False,
        force: bool = False,
Severity: Minor
Found in pywikibot/page/_page.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

There are no issues that match your filters.

Category
Status