Showing 737 of 737 total issues
Function skip_page
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def skip_page(self, page):
"""Skip if -exceptUrl matches or page does not exists."""
if page.exists():
if self.opt.createonly:
pywikibot.warning(f'Skipping because {page} already exists')
- 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 11 (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 test_pages_with_property_generator
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def test_pages_with_property_generator(self):
"""Test the pages_with_property_generator method."""
mysite = self.get_site()
for item in ('defaultsort', 'disambiguation', 'displaytitle',
'hiddencat', 'invalid_property'):
- 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 test_pages_with_property
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def test_pages_with_property(self):
"""Test pages_with_property method."""
mysite = self.get_site()
pnames = mysite.get_property_names()
for item in ('defaultsort', 'disambiguation', 'displaytitle',
- 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 test_search
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def test_search(self):
"""Test the site.search() method."""
mysite = self.site
try:
se = list(mysite.search('wiki', total=100, namespaces=0))
- 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 test_getattr
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def test_getattr(self):
"""Test NamespacesDict.__getattr__."""
for ns_id, values in self.tests.items():
for name in values:
if name.endswith(':') or ' ' in name:
- 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 _test_dedup_int
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def _test_dedup_int(self, deduped, deduper, key=None):
"""Test filter_unique results for int."""
if not key:
key = passthrough
- 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 writelogheader
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def writelogheader() -> None:
"""Save additional version, system and status info to the log file in use.
This may help the user to track errors or report bugs.
- 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 11 (exceeds 10 allowed). Consider refactoring. Open
def main() -> None:
"""Print environment variables."""
_pwb_dir = os.path.abspath(os.path.join(
os.path.split(__file__)[0], '..', '..'))
_pwb_dir = first_upper(_pwb_dir)
- 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 EdittimeFilterPageGenerator
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def EdittimeFilterPageGenerator(
generator: Iterable[pywikibot.page.BasePage],
last_edit_start: datetime.datetime | None = None,
last_edit_end: datetime.datetime | None = None,
first_edit_start: datetime.datetime | 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 _generate_super_hunks
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def _generate_super_hunks(self, hunks: Iterable[Hunk] | None = None
) -> list[_SuperHunk]:
if hunks is None:
hunks = self.hunks
- 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 removeEmptySections
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def removeEmptySections(self, text: str) -> str:
"""Cleanup empty sections."""
# userspace contains article stubs without nobots/in use templates
if self.namespace == Namespace.USER:
return text
- 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 _getSecondsAdjusted
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def _getSecondsAdjusted(self) -> int:
"""Return an internal representation of the time object as seconds.
The value adjusts itself for timezones. It is not compatible
with before/after.
- 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 _parse_log_events
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def _parse_log_events(
logtype: str,
user: str | None = None,
start: str | None = None,
end: 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 _get_cr_templates
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def _get_cr_templates(self, code, fallback) -> None:
"""Build list of category redirect templates."""
if not hasattr(self, '_catredirtemplates'):
self._catredirtemplates = {}
if code in self.category_redirect_templates:
- 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 __call__
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def __call__(self, link: Link | Page,
text: str, groups: Mapping[str, str],
rng: tuple[int, int]) -> Any:
"""Ask user how the selected link should be replaced."""
if self._old == link:
- 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 generator
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def generator(self):
"""
Submit request and iterate the response.
Continues response as needed until limit (if defined) is reached.
- 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 load_pages_from_pageids
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def load_pages_from_pageids(
self,
pageids: str | Iterable[int | str],
) -> Generator[pywikibot.Page, 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 blocks
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def blocks(
self,
starttime: pywikibot.time.Timestamp | None = None,
endtime: pywikibot.time.Timestamp | None = None,
reverse: 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 clean_kwargs
has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring. Open
def clean_kwargs(cls, kwargs: dict) -> dict:
"""
Convert keyword arguments into new parameters mode.
If there are no other arguments in kwargs apart from the used arguments
- 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"