remediate infrastructure technical debt for #867#1354
Conversation
WalkthroughThis PR refactors ReportService URL-builder methods to be public API instead of private, updates dependent Celery tasks and test mocks to use the new public methods, simplifies email template signatures, and performs general code cleanup across imports and Pylint configuration. ChangesReport URL Methods Public Refactoring and Email Service Updates
Code Cleanup and Configuration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
- Configure pylint-django and ignore migrations - Remove unused imports and local variables - Resolve protected access warnings in report services - Simplify email template signatures
9f3e6a0 to
b967047
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
ddpui/utils/email_templates.py (1)
70-70: ⚡ Quick winUpdate docstring to remove unused
author_emailfield.The thread item structure documents
author_email, but the rendering functions (_render_thread_htmlat line 24 and_render_thread_plainat line 50) only useauthor_nameandcontent. Since this PR removes unusedauthor_emailreferences, update the docstring to reflect the actual fields used.📝 Proposed docstring fix
thread: Optional list of prior comments for context. - Each item: {"author_name": str, "author_email": str, "content": str} + Each item: {"author_name": str, "content": str} chart_name: Optional chart title when comment is on a specific chart🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ddpui/utils/email_templates.py` at line 70, The docstring for the thread item list still lists an unused "author_email" field; update the docstring in ddpui/utils/email_templates.py to remove "author_email" so it matches the actual structure used by the rendering functions _render_thread_html and _render_thread_plain (which only reference "author_name" and "content"); ensure the example/description now reads Each item: {"author_name": str, "content": str} and adjust any surrounding wording to remain accurate.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pyproject.toml`:
- Around line 288-304: Move the "fail-under" option out of the
[tool.pylint.messages_control] section and place it into the
[tool.pylint.master] section alongside "ignore" and "load-plugins" so pylint
sees it as a main option; specifically, remove the line fail-under = 8.5 from
the messages_control block and add fail-under = 8.5 under the master block that
contains ignore and load-plugins.
---
Nitpick comments:
In `@ddpui/utils/email_templates.py`:
- Line 70: The docstring for the thread item list still lists an unused
"author_email" field; update the docstring in ddpui/utils/email_templates.py to
remove "author_email" so it matches the actual structure used by the rendering
functions _render_thread_html and _render_thread_plain (which only reference
"author_name" and "content"); ensure the example/description now reads Each
item: {"author_name": str, "content": str} and adjust any surrounding wording to
remain accurate.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3eccbd15-3c25-4b96-8063-4510df7e3e89
📒 Files selected for processing (10)
ddpui/celeryworkers/moretasks.pyddpui/celeryworkers/report_tasks.pyddpui/celeryworkers/tasks.pyddpui/core/reports/mention_service.pyddpui/core/reports/report_service.pyddpui/tests/core/reports/test_mention_notifications.pyddpui/tests/core/reports/test_share_email.pyddpui/utils/email_templates.pyddpui/utils/unified_logger.pypyproject.toml
💤 Files with no reviewable changes (2)
- ddpui/tests/core/reports/test_mention_notifications.py
- ddpui/core/reports/mention_service.py
|
@Ishankoradia May you please tell the reason for closure of this PR! . thanks |
Key Changes
1. Configuration & Accuracy (
pyproject.toml)migrationsandtestsdirectories from Pylint tracking to filter out machine-generated noise and intentional test boilerplate.pylint-django: Integrated the Django plugin to resolve hundreds of false-positiveno-membererrors on dynamic Django model properties (e.g.,Model.objects).fail-underthreshold from 6.5 to 8.5.2. Infrastructure Cleanup
shutil,slugify,GitManager) and redundant local variables acrosstasks.py,unified_logger.py, andmoretasks.py.author_emailandorgarguments from internal methods inemail_templates.pyandmention_service.py, updating all call sites and tests to match.selfarguments with_in@app.task(bind=True)functions to resolveunused-argumentwarnings while maintaining valid signatures.3. Object-Oriented Refinement
_build_private_url,_build_public_url) inReportServiceto public methods, resolvingW0212(protected-access) violations triggered by external Celery workers.addresses #867
Summary by CodeRabbit
Refactor
Chores
@Ishankoradia @siddhant3030 @fatchat please review it