Showing 286 of 616 total issues
Function query
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def query(self, query: str, headers: dict[str, str] | None = None):
"""Run SPARQL query and return parsed JSON result.
.. versionchanged:: 8.5
:exc:`exceptions.NoUsernameError` is raised if the response
- 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 parsevalue
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def parsevalue(self, datatype: str, values: list[str],
options: dict[str, Any] | None = None,
language: str | None = None,
validate: bool = False) -> list[Any]:
"""Send data values to the wikibase parser for interpretation.
- 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_base_dir
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def change_base_dir():
"""Create a new user directory."""
while True:
new_base = pywikibot.input('New user directory? ')
new_base = os.path.abspath(new_base)
- 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 select
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def select(self,
query: str,
full_data: bool = False,
headers: dict[str, str] | None = None
) -> list[dict[str, str]] | 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 normalize
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def normalize(self) -> WbTime:
"""Normalizes the WbTime object to account for precision.
Normalization is needed because WbTime objects can have hidden
values that affect naive comparisons, such as an object set 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 _detect_win32_editor
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def _detect_win32_editor() -> str:
"""Detect the best Win32 editor."""
# Notepad is even worse than our Tkinter editor.
unusable_exes = ['notepad.exe',
'py.exe',
- 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 pagelanglinks
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def pagelanglinks(
self,
page: pywikibot.Page,
*,
total: int | 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 editEntity
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def editEntity(self,
entity: pywikibot.page.WikibaseEntity | dict,
data: dict,
bot: bool = True,
**kwargs) -> dict:
- 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_RegexFilterPageGenerator
has 32 lines of code (exceeds 30 allowed). Consider refactoring. Open
def test_RegexFilterPageGenerator(self):
"""Test RegexFilterPageGenerator."""
self.assertFunction('RegexFilterPageGenerator')
gen = pagegenerators.PagesFromTitlesGenerator(self.titles, self.site)
gen = pagegenerators.RegexFilterPageGenerator(gen, '/doc')
Consider simplifying this complex logical expression. Open
if (removing and not self.conf.autonomous
or modifying and self.problemfound
or not old
or (self.conf.needlimit
and len(adding) + len(modifying)
Function put
has 11 arguments (exceeds 7 allowed). Consider refactoring. Open
def put(self, newtext: str,
Function save
has 11 arguments (exceeds 7 allowed). Consider refactoring. Open
def save(self,
Consider simplifying this complex logical expression. Open
if replaceit and trailing_chars:
newlink = f'[[{new_page_title}{section}]]{trailing_chars}'
elif replaceit or (new_page_title == link_text
and not section):
newlink = f'[[{new_page_title}]]'
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 editpage
has 11 arguments (exceeds 7 allowed). Consider refactoring. Open
def editpage(
Function load_topiclist
has 11 arguments (exceeds 7 allowed). Consider refactoring. Open
def load_topiclist(self,
Function __init__
has 11 arguments (exceeds 7 allowed). Consider refactoring. Open
def __init__(self, lat: float, lon: float, alt: float | None = None,
Function parse
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def parse(argv: Sequence[str],
generator_factory: pagegenerators.GeneratorFactory
) -> dict[str, bool | str]:
"""Parses our arguments and provide a dictionary with their values.
- 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 14 (exceeds 10 allowed). Consider refactoring. Open
def treat_page(self) -> None:
"""Process one page from the generator."""
if self.opt.undelete:
self.current_page.undelete(self.summary)
self.counter['undelete'] += 1
- 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_dump_name
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def get_dump_name(db_name, typ, dumpdate):
"""Check if dump file exists locally in a Toolforge server."""
db_path = f'/public/dumps/public/{db_name}/'
if os.path.isdir(db_path):
dump_filepath_template = (
- 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"