wikimedia/pywikibot

View on GitHub
scripts/interwiki.py

Summary

Maintainability
F
4 days
Test Coverage

File interwiki.py has 1872 lines of code (exceeds 900 allowed). Consider refactoring.
Open

#!/usr/bin/env python3
"""
Script to check language links for general pages.

Uses existing translations of a page, plus hints from the command line, to
Severity: Major
Found in scripts/interwiki.py - About 3 days to fix

    Function readOptions has a Cognitive Complexity of 32 (exceeds 10 allowed). Consider refactoring.
    Open

        def readOptions(self, option: str) -> bool:
            """Read all commandline parameters for the global container."""
            arg, _, value = option.partition(':')
            if not arg.startswith('-'):
                return False
    Severity: Minor
    Found in scripts/interwiki.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

    Consider simplifying this complex logical expression.
    Open

            if (not self.workonme  # we don't work on it anyway
                or not self.untranslated and not self.conf.askhints
                or self.hintsAsked
                or not self.origin
                or not self.origin.exists()
    Severity: Critical
    Found in scripts/interwiki.py - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

                      if (removing and not self.conf.autonomous
                          or modifying and self.problemfound
                          or not old
                          or (self.conf.needlimit
                              and len(adding) + len(modifying)
      Severity: Major
      Found in scripts/interwiki.py - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                if arg == 'noauto':
                    self.auto = False
                elif arg == 'hint':
                    self.hints.append(value)
                elif arg == 'hintfile':
        Severity: Major
        Found in scripts/interwiki.py - About 40 mins to fix

          TODO found
          Open

                      # TODO: allow answer to repeat previous or go back after a mistake
          Severity: Minor
          Found in scripts/interwiki.py by fixme

          TODO found
          Open

                      # TODO: allow answer to repeat previous or go back after a mistake
          Severity: Minor
          Found in scripts/interwiki.py by fixme

          TODO found
          Open

                              # TODO: allow these cases to be propagated!
          Severity: Minor
          Found in scripts/interwiki.py by fixme

          FIXME found
          Open

                      # FIXME: What errors are we catching here?
          Severity: Minor
          Found in scripts/interwiki.py by fixme

          BUG found
          Open

                      raise SaveError('BUG: sanity check failed')
          Severity: Minor
          Found in scripts/interwiki.py by fixme

          TODO found
          Open

                      # TODO: make this possible as well.
          Severity: Minor
          Found in scripts/interwiki.py by fixme

          TODO found
          Open

                  # TODO: should be move to assemble()
          Severity: Minor
          Found in scripts/interwiki.py by fixme

          There are no issues that match your filters.

          Category
          Status