wikimedia/pywikibot

View on GitHub
pywikibot/cosmetic_changes.py

Summary

Maintainability
C
1 day
Test Coverage

Function cleanUpLinks has a Cognitive Complexity of 33 (exceeds 10 allowed). Consider refactoring.
Open

    def cleanUpLinks(self, text: str) -> str:
        """Tidy up wikilinks found in a string.

        This function will:

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

    def translateAndCapitalizeNamespaces(self, text: str) -> str:
        """Use localized namespace names.

        .. versionchanged:: 7.4
           No longer expect a specific namespace alias for File:
Severity: Minor
Found in pywikibot/cosmetic_changes.py - About 3 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 standardizePageFooter has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
Open

    def standardizePageFooter(self, text: str) -> str:
        """
        Standardize page footer.

        Makes sure that interwiki links and categories are put
Severity: Minor
Found in pywikibot/cosmetic_changes.py - About 55 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 translateMagicWords has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
Open

    def translateMagicWords(self, text: str) -> str:
        """Use localized magic words."""
        # not wanted at ru
        # arz uses English stylish codes
        # no need to run on English wikis
Severity: Minor
Found in pywikibot/cosmetic_changes.py - About 55 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 removeEmptySections has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
Open

    def removeEmptySections(self, text: str) -> str:
        """Cleanup empty sections."""
        # userspace contains article stubs without nobots/in use templates
        if self.namespace == Namespace.USER:
            return text
Severity: Minor
Found in pywikibot/cosmetic_changes.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

TODO found
Open

        # TODO: T254350 - what other extension tags should be avoided?
Severity: Minor
Found in pywikibot/cosmetic_changes.py by fixme

FIXME found
Open

            # FIXME: but changes letters inside wikilinks
Severity: Minor
Found in pywikibot/cosmetic_changes.py by fixme

TODO found
Open

        # TODO: maybe we can make the bot replace <p> tags with \r\n's.
Severity: Minor
Found in pywikibot/cosmetic_changes.py by fixme

TODO found
Open

            # TODO: Sort categories in alphabetic order, e.g. using
Severity: Minor
Found in pywikibot/cosmetic_changes.py by fixme

TODO found
Open

# TODO: Maybe move it to family file and implement global instances
Severity: Minor
Found in pywikibot/cosmetic_changes.py by fixme

TODO found
Open

                # TODO: Add a configuration variable for each site,
Severity: Minor
Found in pywikibot/cosmetic_changes.py by fixme

TODO found
Open

            # TODO: Get main categories from Wikidata?
Severity: Minor
Found in pywikibot/cosmetic_changes.py by fixme

There are no issues that match your filters.

Category
Status