🧹 refactor: split _capture_initialized_submodules to fix long function issue - #64
🧹 refactor: split _capture_initialized_submodules to fix long function issue#64joy7758 wants to merge 2 commits into
Conversation
Extracted the heavily nested processing logic of a single submodule from the loop in _capture_initialized_submodules into a new helper function, _capture_initialized_submodule. This improves code readability and fixes the long function issue. Co-authored-by: joy7758 <138868899+joy7758@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Addressed Ruff CI failures by auto-fixing the sorting of imports and unused imports in `src/titmas_action_gate/service.py`, `tests/test_security_argument_injection.py`, and `tests/test_workflow.py`. Also removed unnecessary file mode arguments (`"r"`) in `tests/test_workflow.py`. Co-authored-by: joy7758 <138868899+joy7758@users.noreply.github.com>
🎯 What: The code health issue addressed was a "Long Function" violation in
src/titmas_action_gate/pr_gate.py:829. The_capture_initialized_submodulesfunction contained a large loop body making it difficult to read and maintain.💡 Why: Splitting this logic into a separate
_capture_initialized_submodulefunction improves maintainability by reducing the cognitive load of a single function, making it easier to test components individually, and clarifying the boundaries of what processing happens for each submodule.✅ Verification: I confirmed the change was safe by verifying the
catoutput of the file, running formatting (ruff format) and linting (ruff check) which passed, running the full unit test suite (pre-existing failures were not regressions), and executing the customvalidate_governance.pyandvalidate_milestone.pyvalidation scripts.✨ Result: The
_capture_initialized_submodulesfunction was drastically simplified to focus solely on iterating entries and accumulating results, delegating the complex per-submodule processing logic to the new_capture_initialized_submodulehelper function.PR created automatically by Jules for task 6875367628931071477 started by @joy7758