Xqt created this task.
Xqt added projects: Pywikibot, Pywikibot-replace.py, Pywikibot-tests.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
  **Reduce code complexity of `replace.main()`**
  
  **Description:**  
  The main() function in scripts/replace.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/T402153

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to