Showing 286 of 616 total issues
File transliteration.py
has 1100 lines of code (exceeds 900 allowed). Consider refactoring. Open
"""Module to transliterate text."""
#
# (C) Pywikibot team, 2006-2024
#
# Distributed under the terms of the MIT license.
Function __new__
has a Cognitive Complexity of 47 (exceeds 10 allowed). Consider refactoring. Open
def __new__(cls, name, bases, dct):
"""Create the new class."""
def test_execution(script_name, args=None):
if args is None:
args = []
- 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 43 (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
File page_tests.py
has 1051 lines of code (exceeds 900 allowed). Consider refactoring. Open
#!/usr/bin/env python3
"""Tests for the page module."""
#
# (C) Pywikibot team, 2008-2024
#
File solve_disambiguation.py
has 1051 lines of code (exceeds 900 allowed). Consider refactoring. Open
#!/usr/bin/env python3
"""Script to help a human solve disambiguations by presenting a set of options.
Specify the disambiguation page on the command line.
Function get_base_dir
has a Cognitive Complexity of 42 (exceeds 10 allowed). Consider refactoring. Open
def get_base_dir(test_directory: str | None = None,
config_file: str = 'user-config.py') -> str:
r"""Return the directory in which user-specific information is stored.
This is determined in the following order:
- 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 getCombinedGenerator
has a Cognitive Complexity of 42 (exceeds 10 allowed). Consider refactoring. Open
def getCombinedGenerator(self, # noqa: N802
gen: OPT_GENERATOR_TYPE = None,
preload: bool = False) -> OPT_GENERATOR_TYPE:
"""Return the combination of all accumulated generators.
- 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
File site_tests.py
has 1044 lines of code (exceeds 900 allowed). Consider refactoring. Open
#!/usr/bin/env python3
"""Tests for the site module."""
#
# (C) Pywikibot team, 2008-2024
#
Function translate
has a Cognitive Complexity of 41 (exceeds 10 allowed). Consider refactoring. Open
def translate(
page=None,
hints: list[str] | None = None,
auto: bool = True,
removebrackets: 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 preloadpages
has a Cognitive Complexity of 41 (exceeds 10 allowed). Consider refactoring. Open
def preloadpages(
self,
pagelist: Iterable[pywikibot.Page],
*,
groupsize: 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 process
has a Cognitive Complexity of 40 (exceeds 10 allowed). Consider refactoring. Open
def process(self, text):
"""Process the page."""
# keys are ref groups
# values are a dict where :
# keys are ref content
- 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
File proofreadpage.py
has 1032 lines of code (exceeds 900 allowed). Consider refactoring. Open
"""Objects used with ProofreadPage Extension.
OCR support of page scans via:
- Wikimedia OCR, see:
Function parse_page_tuples
has a Cognitive Complexity of 38 (exceeds 10 allowed). Consider refactoring. Open
def parse_page_tuples(self, wikitext, user=None):
"""Parse page details apart from 'user:' for use."""
whitelist = defaultdict(set)
current_user = 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
File _requests.py
has 1021 lines of code (exceeds 900 allowed). Consider refactoring. Open
"""Objects representing API requests."""
#
# (C) Pywikibot team, 2007-2024
#
# Distributed under the terms of the MIT license.
Function loadrevisions
has a Cognitive Complexity of 37 (exceeds 10 allowed). Consider refactoring. Open
def loadrevisions(
self,
page: pywikibot.Page,
*,
content: 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 editEntity
has a Cognitive Complexity of 35 (exceeds 10 allowed). Consider refactoring. Open
def editEntity(
self,
data: ENTITY_DATA_TYPE | None = None,
**kwargs
) -> 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 package_versions
has a Cognitive Complexity of 35 (exceeds 10 allowed). Consider refactoring. Open
def package_versions(
modules: list[str] | None = None,
builtins: bool | None = False,
standard_lib: bool | 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 put_mex_in_talk
has a Cognitive Complexity of 33 (exceeds 10 allowed). Consider refactoring. Open
def put_mex_in_talk(self) -> None:
"""Function to put the warning in talk page of the uploader.
When the bot find that the usertalk is empty it adds the welcome
message first. The messages are imported from welcome.py script.
- 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 analyze_page
has a Cognitive Complexity of 33 (exceeds 10 allowed). Consider refactoring. Open
def analyze_page(self) -> set[tuple[str, str]]:
"""Analyze DiscussionPage."""
max_size = self.get_attr('maxarchivesize')
max_arch_size = str2size(max_size)
if not max_arch_size[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 run
has a Cognitive Complexity of 32 (exceeds 10 allowed). Consider refactoring. Open
def run(self) -> None:
"""Run bot."""
def convert_from_bytes(total_bytes):
for unit in ['B', 'K', 'M', 'G', 'T']:
if abs(total_bytes) < 1024:
- 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"