Moves the program post_save signal handler to the module's top level and eliminating the class wrapper#3446
Conversation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughReplaced a class-based Program post-save signal handler with a module-level function and updated the package export to expose the new function; the receiver decorator was moved from the class method to the standalone function. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR refactors the Program post_save signal handler by removing an unnecessary class wrapper and moving the handler to the module's top level, addressing SonarCloud code smell python:S5720.
Changes:
- Converted class-based signal handler to a module-level function
- Updated parameter naming to use underscore prefix for unused parameters (
_sender,**_kwargs) - Updated imports to reference the function directly instead of the class
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
backend/apps/mentorship/signals/program.py |
Removed ProgramPostSaveHandler class wrapper and converted signal handler to module-level function with proper parameter naming |
backend/apps/mentorship/signals/__init__.py |
Updated import to reference the function program_post_save_clear_algolia_cache instead of the removed class |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3446 +/- ##
============================
============================
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
Hi @PawanMohit16 , I have implemented a solution in this PR . |
|
Hello @mrkeshav-05 Thanks for pointing it out! |




Proposed change
Resolves #3440
Moves the program post_save signal handler to the module's top level and importing it directly. The class wrapper is eliminated and thereby fixing the SonarCloud python:S5720 code smell.
Checklist
make check-testlocally: all warnings addressed, tests passed