Refactored three highly complex functions to improve code maintainability: 1. PollerWorker.detect_sensor_changes (complexity 33 -> ~9): - Extracted threshold checking logic into separate functions - Split event creation into focused helper functions - Reduced nesting by using pipe operator pattern 2. PollerWorker.detect_and_log_changes (complexity 16 -> ~5): - Created separate functions for each interface change type - Extracted event building logic into dedicated functions - Improved readability with clear function names 3. EquipmentLive.Show.format_duration (complexity 13 -> ~5): - Extracted time unit conversion into separate functions - Simplified pluralization logic with pattern matching - Reduced nested conditionals These changes make the code easier to test, maintain, and understand while preserving all existing functionality. |
||
|---|---|---|
| .. | ||
| components | ||
| controllers | ||
| live | ||
| endpoint.ex | ||
| gettext.ex | ||
| router.ex | ||
| telemetry.ex | ||
| user_auth.ex | ||