Implement boiler_temperature dict for legacy Anna#893
Conversation
|
Warning Review limit reached
Next review available in: 48 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughLegacy Anna boiler data is migrated from ChangesLegacy Anna boiler temperature
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #893 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 21 21
Lines 3502 3503 +1
=========================================
+ Hits 3502 3503 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
plugwise/legacy/helper.py (1)
344-376: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReduce cognitive complexity to satisfy SonarCloud threshold.
SonarCloud reports cognitive complexity 17 (limit 15) for
_get_actuator_functionalities. Extracting the boiler-temperature migration logic into a small helper method would reduce complexity and improve testability. This also resolves the scoping concern raised above.♻️ Suggested extraction
+ def _migrate_boiler_temperature( + self, temp_dict: ActuatorData, data: GwEntityData + ) -> None: + """Move water_temperature sensor into boiler_temperature.current.""" + if "water_temperature" in data["sensors"]: + temp_dict["current"] = data["sensors"]["water_temperature"] + data["sensors"].pop("water_temperature") + def _get_actuator_functionalities( self, xml: etree.Element, data: GwEntityData ) -> None: ... if temp_dict: if item == "maximum_boiler_temperature": item = "boiler_temperature" - if "water_temperature" in data["sensors"]: - temp_dict["current"] = data["sensors"]["water_temperature"] - data["sensors"].pop("water_temperature") + self._migrate_boiler_temperature(temp_dict, data)🤖 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 `@plugwise/legacy/helper.py` around lines 344 - 376, Reduce cognitive complexity in _get_actuator_functionalities by extracting the boiler-temperature migration and water_temperature transfer into a dedicated helper method. Have the helper update the actuator item and temp_dict, then invoke it before casting and storing the actuator data; preserve the existing behavior and make the helper independently testable.Source: Linters/SAST tools
🤖 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 `@plugwise/legacy/helper.py`:
- Around line 369-374: The water_temperature migration currently runs for
unrelated items and may remove the sensor prematurely. In the item-processing
logic, scope the water_temperature lookup, temp_dict["current"] assignment, and
sensor removal inside the if item == "maximum_boiler_temperature" branch,
alongside the item rename to boiler_temperature.
---
Nitpick comments:
In `@plugwise/legacy/helper.py`:
- Around line 344-376: Reduce cognitive complexity in
_get_actuator_functionalities by extracting the boiler-temperature migration and
water_temperature transfer into a dedicated helper method. Have the helper
update the actuator item and temp_dict, then invoke it before casting and
storing the actuator data; preserve the existing behavior and make the helper
independently testable.
🪄 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: f63dd7a5-7c19-4148-8b56-78f1e9c04e23
📒 Files selected for processing (6)
CHANGELOG.mdfixtures/legacy_anna/data.jsonfixtures/legacy_anna_2/data.jsonplugwise/legacy/helper.pytests/data/anna/legacy_anna.jsontests/data/anna/legacy_anna_2.json
|



Summary by CodeRabbit
New Features
Tests