Showing 286 of 616 total issues
Function treat_disamb_only
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def treat_disamb_only(self, ref_page, disamb_page) -> str:
"""Resolve the links to disamb_page but don't look for its redirects.
:param disamb_page: the disambiguation page or redirect we don't want
anything to link to
- 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 addReferences
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def addReferences(self, oldText) -> str:
"""Add a references tag into an existing section where it fits into.
If there is no such section, creates a new section containing
the references tag. Also repair malformed references tags.
- 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 __iter__
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def __iter__(self) -> Generator[pywikibot.Page]:
"""Yield pages."""
# TODO: start yielding before all referring pages have been found
refs = list(self.page.getReferences(with_template_inclusion=False,
namespaces=0 if self.main_only
- 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 run
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def run(self) -> None:
"""Main function of CategoryGraphBot."""
self.scan_level(self.cat, int(self.args.depth))
# reduce too big graph
if self.counter > 1000:
- 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 lacksReferences
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def lacksReferences(self, text) -> bool:
"""Check whether or not the page is lacking a references tag."""
oldTextCleaned = textlib.removeDisabledParts(text)
if self.referencesR.search(oldTextCleaned) \
or self.referencesTagR.search(oldTextCleaned):
- 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_watchlist_revs
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def test_watchlist_revs(self):
"""Test the site.watchlist_revs() method."""
mysite = self.get_site()
wl = list(mysite.watchlist_revs(total=10))
self.assertLessEqual(len(wl), 10)
- 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 daemonize
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def daemonize(close_fd: bool = True,
chdir: bool = True,
redirect_std: str | None = None) -> None:
"""Daemonize the current process.
- 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 handle
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def handle(self) -> Any:
"""Handle by either applying the new section or label."""
if not self.replacer:
raise ValueError('LinkChoice requires a replacer')
- 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 create_diff
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def create_diff(self) -> Iterable[str]:
"""Generator of diff text for this hunk, without formatting.
Check each line ends with line feed to prevent behaviour like
:issue:`46395`
- 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 _upload
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def _upload(self, ignore_warnings, report_success,
file_key=None, offset=0) -> bool:
"""Recursive Upload method.
:param file_key: Reuses an already uploaded file using 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 translateMagicWords
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def translateMagicWords(self, text: str) -> str:
"""Use localized magic words."""
# not wanted at ru
# arz uses English stylish codes
# no need to run on English wikis
- 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 blockuser
has 10 arguments (exceeds 7 allowed). Consider refactoring. Open
def blockuser(
Function topics
has 10 arguments (exceeds 7 allowed). Consider refactoring. Open
def topics(self, *,
Function usercontribs
has 10 arguments (exceeds 7 allowed). Consider refactoring. Open
def usercontribs(
Function logevents
has 10 arguments (exceeds 7 allowed). Consider refactoring. Open
def logevents(
Function allimages
has 10 arguments (exceeds 7 allowed). Consider refactoring. Open
def allimages(
Function treat
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def treat(self, page):
"""Treat a single page."""
if not page.exists():
pywikibot.info('*** The sandbox is not existent, skipping.')
return
- 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 deeply nested control flow statements. Open
while result <= maxlen:
result += 1
final = redirects[final]
# only yield multiple or broken redirects
Function determine_type_target
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def determine_type_target(
self,
page: pywikibot.Page
) -> pywikibot.Page | None:
"""Return page to be categorized by type.
- 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 __new__
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
def __new__(cls, name, bases, dct):
"""Create the new class."""
def test_method(formatname):
def testMapEntry(self):
- 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"