File checkimages.py
has 1353 lines of code (exceeds 900 allowed). Consider refactoring. Open
#!/usr/bin/env python3
"""Script to check recently uploaded files.
This script checks if a file description is present and if there are
other problems in the image's description.
Function put_mex_in_talk
has a Cognitive Complexity of 33 (exceeds 10 allowed). Consider refactoring. Open
def put_mex_in_talk(self) -> None:
"""Function to put the warning in talk page of the uploader.
When the bot find that the usertalk is empty it adds the welcome
message first. The messages are imported from welcome.py script.
- 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
Function check_image_on_commons
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def check_image_on_commons(self) -> bool:
"""Checking if the file is on commons."""
pywikibot.info(f'Checking if [[{self.image_name}]] is on commons...')
try:
hash_found = self.image.latest_file_info.sha1
- 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
Function report
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def report(
self,
newtext,
image_to_report,
notification=None,
- 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
Function report
has 8 arguments (exceeds 7 allowed). Consider refactoring. Open
def report(
TODO found Open
# TODO: enhance and use textlib.MultiTemplateMatchBuilder
- Exclude checks