aprs.me/lib/aprsme_web
Graham McIntire ee02769d38
refactor: pattern-match in HealthCheck, EncodingUtils, and StatusLive helpers
- HealthCheck.check_health(:readiness): collapse the 3-branch cond into
  readiness_status/2 dispatched on (health_status, shutting_down?).
- HealthCheck.shutting_down?: the whereis + alive? + try/catch nest
  becomes a small pipeline of function heads (ask_shutting_down?/1 +
  ask_if_alive/2), with the catch isolated to the single place it fires.
- EncodingUtils.sanitize_string_fields and sanitize_nested_map shared a
  three-branch atom-or-string key lookup. Extract update_existing_key/3
  + first_present_key/3 + nil_aware/1 helpers; the original functions
  become two-liners.
- StatusLive.Index.format_uptime: splits the cond into
  format_uptime_parts/4 clauses with numeric guards.
- StatusLive.Index.calculate_health_score: struct-shape pattern match
  on %{connected: false} / %{uptime_seconds: s} guards replaces the cond.
- StatusLive.Index.format_time_ago: pipe the diff through
  format_seconds_ago/1 with four clauses.

Adds tests for the four public StatusLive.Index helpers
(format_uptime, format_time_ago, get_health_description, format_number).
Coverage 67.29 → 67.43%.
2026-04-23 14:02:50 -05:00
..
channels perf(packets): keyset-based pagination for recent-packet queries 2026-04-21 10:15:04 -05:00
components fix: address security vulnerabilities and concurrency issues 2026-03-23 16:59:09 -05:00
controllers refactor: pattern-match in TimeHelpers.to_datetime and PageController 2026-04-23 13:58:42 -05:00
live refactor: pattern-match in HealthCheck, EncodingUtils, and StatusLive helpers 2026-04-23 14:02:50 -05:00
plugs refactor: pattern-match in HealthCheck, EncodingUtils, and StatusLive helpers 2026-04-23 14:02:50 -05:00
aprs_symbol.ex chore(dialyzer): enable stricter flags and fix 97 resulting findings 2026-04-21 10:07:01 -05:00
endpoint.ex fix: performance improvements and bug fixes across backend and frontend 2026-03-19 12:41:36 -05:00
gettext.ex more languages 2025-07-06 10:08:58 -05:00
router.ex feat: add sitemap.xml, api-catalog, and agent-discovery Link headers 2026-04-17 13:31:21 -05:00
telemetry.ex Fix code review findings: security, correctness, performance, dead code 2026-02-19 18:49:27 -06:00
time_helpers.ex refactor: pattern-match in TimeHelpers.to_datetime and PageController 2026-04-23 13:58:42 -05:00
time_utils.ex improve dialyzer 2025-10-13 10:02:15 -05:00
user_auth.ex chore(dialyzer): enable stricter flags and fix 97 resulting findings 2026-04-21 10:07:01 -05:00
weather_units.ex Refactor conditionals to use multi-clause pattern matching 2026-02-10 17:15:49 -06:00