Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@raman325
Copy link
Owner

@raman325 raman325 commented Jan 2, 2026

Proposed change

  • Extract Lovelace resource registration/removal into helpers to reduce nesting
  • Simplify unload cleanup flow using the helper
  • Use sets for entities_to_add/remove to clarify intent
  • Remove duplicate invoke_lock_slot_adders call when adding new slots
  • Add TODO note about config entry data/options usage guidance

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: n/a
  • This PR is related to issue: n/a

Copilot AI review requested due to automatic review settings January 2, 2026 08:07
@github-actions github-actions bot added code-quality Pull requests that improve code quality python Pull requests that update Python code labels Jan 2, 2026
@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

❌ Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.29%. Comparing base (f0fb3ed) to head (9e1c42d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
custom_components/lock_code_manager/__init__.py 95.74% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #710      +/-   ##
==========================================
- Coverage   89.32%   89.29%   -0.03%     
==========================================
  Files          29       29              
  Lines        1921     1925       +4     
  Branches       66       66              
==========================================
+ Hits         1716     1719       +3     
- Misses        205      206       +1     
Flag Coverage Δ
python 88.92% <95.74%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@raman325 raman325 force-pushed the refactor/init-cleanup branch from 86b306d to 29c57af Compare January 2, 2026 08:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Lovelace resource management code to improve maintainability by extracting helper functions, simplifies entity tracking by converting from dictionaries to sets, removes duplicate code, and documents TODO guidance for config entry data vs options usage.

  • Extracted Lovelace resource registration and cleanup logic into dedicated helper functions
  • Changed entity tracking from dict[str, bool] to set[str] for clearer intent
  • Documented TODO item about config entry data vs options usage guidance

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
custom_components/lock_code_manager/init.py Refactored Lovelace resource handling into helper functions (_get_lovelace_resources, _async_register_strategy_resource, _async_cleanup_strategy_resource), converted entity tracking from dicts to sets, and removed duplicate invoke_lock_slot_adders calls
TODO.md Added documentation TODO for clarifying when to use config_entry.data vs config_entry.options

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@raman325 raman325 merged commit 058bcee into main Jan 2, 2026
5 of 7 checks passed
@raman325 raman325 deleted the refactor/init-cleanup branch January 2, 2026 08:14
raman325 added a commit that referenced this pull request Jan 2, 2026
* main:
  Refactor init setup helpers and document data/options TODO (#710)
  Guard YAML mode resource removal earlier (#709)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-quality Pull requests that improve code quality python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants