Xqt created this task.
Xqt added projects: Pywikibot, Pywikibot-tests.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION
Reduce code complexity of `category.main()`
**Description:**
The `main()` function in `scripts/category.py` has grown too large and
complex over time. It currently triggers a C901 ("function is too complex")
warning when running code quality checks (flake8/mccabe).
High complexity makes the function harder to understand, test, and maintain.
In particular:
Multiple nested conditionals and loops
Several distinct responsibilities handled in one function
Many edge cases mixed into the main execution flow
**Suggested improvements:**
Split `main()` into smaller helper functions, each handling a specific
concern (argument parsing, summary handling, replacements iteration, etc.).
Reduce cyclomatic complexity below the flake8/mccabe threshold.
Add or update unit tests to cover the extracted functionality.
**Benefits:**
Improves readability and maintainability.
Easier testing of individual parts.
Aligns with Python style guidelines and helps keep CI checks green.
TASK DETAIL
https://phabricator.wikimedia.org/T434526
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]