scripts/interwiki.py
File interwiki.py
has 1872 lines of code (exceeds 900 allowed). Consider refactoring. Open
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
Function readOptions
has a Cognitive Complexity of 32 (exceeds 10 allowed). Consider refactoring. Open
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
- Read upRead up
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
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()
Consider simplifying this complex logical expression. Open
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)
Consider simplifying this complex logical expression. Open
Open
if arg == 'noauto':
self.auto = False
elif arg == 'hint':
self.hints.append(value)
elif arg == 'hintfile':
TODO found Open
Open
# TODO: allow answer to repeat previous or go back after a mistake
- Exclude checks
TODO found Open
Open
# TODO: allow answer to repeat previous or go back after a mistake
- Exclude checks
TODO found Open
Open
# TODO: allow these cases to be propagated!
- Exclude checks
FIXME found Open
Open
# FIXME: What errors are we catching here?
- Exclude checks
BUG found Open
Open
raise SaveError('BUG: sanity check failed')
- Exclude checks
TODO found Open
Open
# TODO: make this possible as well.
- Exclude checks
TODO found Open
Open
# TODO: should be move to assemble()
- Exclude checks