File _basepage.py
has 1827 lines of code (exceeds 900 allowed). Consider refactoring. Open
"""Objects representing a base object for a MediaWiki page."""
#
# (C) Pywikibot team, 2008-2024
#
# Distributed under the terms of the MIT license.
Function _check_bot_may_edit
has a Cognitive Complexity of 63 (exceeds 10 allowed). Consider refactoring. Open
def _check_bot_may_edit(self, module: str | None = None) -> bool:
"""A botMayEdit helper method.
:param module: The module name to be restricted. Defaults to
:func:`pywikibot.calledModuleName`.
- 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 title
has a Cognitive Complexity of 30 (exceeds 10 allowed). Consider refactoring. Open
def title(
self,
*,
underscore: bool = False,
with_ns: bool = True,
- 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 change_category
has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring. Open
def change_category(self, old_cat, new_cat,
summary: str | None = None,
sort_key=None,
in_place: bool = True,
include: list[str] | None = 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 isCategoryRedirect
has a Cognitive Complexity of 20 (exceeds 10 allowed). Consider refactoring. Open
def isCategoryRedirect(self) -> bool:
"""Return True if this is a category redirect page, False otherwise."""
if not self.is_categorypage():
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
Function delete
has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring. Open
def delete(
self,
reason: str | None = None,
prompt: bool = True,
mark: bool = 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
Function extract
has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring. Open
def extract(self, variant: str = 'plain', *,
lines: int | None = None,
chars: int | None = None,
sentences: int | None = None,
intro: bool = True) -> str:
- 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 revisions
has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring. Open
def revisions(self,
reverse: bool = False,
total: int | None = None,
content: bool = False,
starttime=None, endtime=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 title
has 12 arguments (exceeds 7 allowed). Consider refactoring. Open
def title(
Function put
has 11 arguments (exceeds 7 allowed). Consider refactoring. Open
def put(self, newtext: str,
Consider simplifying this complex logical expression. Open
if force_interwiki \
or (allow_interwiki
and (self.site.family.name != target_family
or self.site.code != target_code)):
if self.site.family.name not in (
Function save
has 11 arguments (exceeds 7 allowed). Consider refactoring. Open
def save(self,
Function isDisambig
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def isDisambig(self) -> bool:
"""
Return True if this is a disambiguation page, False otherwise.
By default, it uses the Disambiguator extension's result. The
- 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 getReferences
has 8 arguments (exceeds 7 allowed). Consider refactoring. Open
def getReferences(self,
Function _save
has 8 arguments (exceeds 7 allowed). Consider refactoring. Open
def _save(self, summary=None, watch=None, minor: bool = True, botflag=None,
Function change_category
has 8 arguments (exceeds 7 allowed). Consider refactoring. Open
def change_category(self, old_cat, new_cat,
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return True
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return False
FIXME found Open
# FIXME: We might want to fill _langlinks when the Site
- Exclude checks
TODO found Open
# TODO: what other exceptions might be returned?
- Exclude checks
FIXME found Open
# FIXME: bug T75561: with_sort_key is ignored by Site.pagecategories
- Exclude checks
TODO found Open
# TODO: Only request uncached revisions
- Exclude checks