wikimedia/pywikibot

View on GitHub

Showing 286 of 616 total issues

Function load_pages_from_pageids has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
Open

    def load_pages_from_pageids(
        self,
        pageids: str | Iterable[int | str],
    ) -> Generator[pywikibot.Page, None, None]:
        """Return a page generator from pageids.
Severity: Minor
Found in pywikibot/site/_generators.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 clean_kwargs has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
Open

    def clean_kwargs(cls, kwargs: dict) -> dict:
        """Convert keyword arguments into new parameters mode.

        If there are no other arguments in kwargs apart from the used arguments
        by the class' initializer it'll just return kwargs and otherwise remove
Severity: Minor
Found in pywikibot/data/api/_requests.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 _generate_super_hunks has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
Open

    def _generate_super_hunks(self, hunks: Iterable[Hunk] | None = None
                              ) -> list[_SuperHunk]:
        if hunks is None:
            hunks = self.hunks

Severity: Minor
Found in pywikibot/diff.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 _getSecondsAdjusted has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
Open

    def _getSecondsAdjusted(self) -> int:
        """Return an internal representation of the time object as seconds.

        The value adjusts itself for timezones. It is not compatible
        with before/after.
Severity: Minor
Found in pywikibot/_wbtypes.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 writelogheader has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
Open

def writelogheader() -> None:
    """Save additional version, system and status info to the log file in use.

    This may help the user to track errors or report bugs.

Severity: Minor
Found in pywikibot/bot.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 _parse has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
Open

    def _parse(self, version_str: str) -> None:
        version_match = MediaWikiVersion.MEDIAWIKI_VERSION.fullmatch(
            version_str)

        if not version_match:
Severity: Minor
Found in pywikibot/tools/__init__.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