Function checkCommonscatLink
has a Cognitive Complexity of 23 (exceeds 10 allowed). Consider refactoring. Open
def checkCommonscatLink(self, name: str = ''):
"""Return the name of a valid commons category.
If the page is a redirect this function tries to follow it.
If the page doesn't exists the function will return an empty string
- 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 skipPage
has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring. Open
def skipPage(page) -> bool:
"""Determine if the page should be skipped."""
try:
templates_to_ignore = ignoreTemplates[page.site.code]
except KeyError:
- 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 treat_page
has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring. Open
def treat_page(self) -> None:
"""
Add CommonsCat template to page.
Take a page. Go to all the interwiki page looking for a commonscat
- 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 main
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def main(*args: str) -> None:
"""
Process command line arguments and invoke bot.
If args is an empty list, sys.argv is used.
- 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 getCommonscatLink
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def getCommonscatLink(page): # noqa: N802
"""Find CommonsCat template on page.
:rtype: tuple of (<templatename>, <target>, <linktext>, <note>)
"""
- 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
Avoid too many return
statements within this function. Open
return self.checkCommonscatLink(
Avoid too many return
statements within this function. Open
return commonsPage.title(with_ns=False)
Avoid too many return
statements within this function. Open
return ''
Avoid too many return
statements within this function. Open
return ''
Avoid too many return
statements within this function. Open
return self.checkCommonscatLink(param[0])
TODO found Open
# TODO: if the commonsLink == '', should it be removed?
- Exclude checks
TODO found Open
return # TODO: handle additional param on de-wiki
- Exclude checks