scripts/category.py
File category.py
has 1360 lines of code (exceeds 900 allowed). Consider refactoring. Open
Open
#!/usr/bin/env python3
"""Script to manage categories.
Syntax:
Function __init__
has 18 arguments (exceeds 7 allowed). Consider refactoring. Open
Open
def __init__(self, oldcat,
Function list_categories
has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring. Open
Open
def list_categories(cat_list, prefix: str = '') -> None:
"""Output categories in one or two columns.
Determine whether the list contains long or short
category titles and output category titles as enumerated
- 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 __init__
has 12 arguments (exceeds 7 allowed). Consider refactoring. Open
Open
def __init__(self, cat_title: str | None, list_title: str | None,
Function determine_type_target
has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring. Open
Open
def determine_type_target(
self,
page: pywikibot.Page
) -> pywikibot.Page | 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
Avoid too many return
statements within this function. Open
Open
return None
TODO found Open
Open
# TODO: use options instead following variables:
- Exclude checks
TODO found Open
Open
TODO: decide if/how to enable/disable this feature.
- Exclude checks