Enforce cyclomatic complexity ≤ 5 across iOS codebase
Resolve all 31 SwiftLint cyclomatic_complexity warnings so the error threshold can drop from 50 to 5 and block CI on violations.
Objective
Bring every function in ios/ to cyclomatic complexity ≤ 5 so the SwiftLint error threshold can be dropped from its current holding value of 50 down to 5, making violations CI-blocking.
Why now
cyclomatic_complexity was re-enabled in .swiftlint.yml after being disabled since EPAC-334. The linter found 31 violations across 15 files. The rule was set to warning: 5, error: 50 so CI still passed, but the warnings were live. This project cleared the backlog and locked the gate.
Architecture notes
All violations are in the adapter/infrastructure layer (services, parsers, views). Refactoring must not change the observable behavior of any function — no new ports, no new use cases. The only architecture constraint is that the cyclomatic_complexity warning count must be zero when each PR merges.
Mergeability plan
All implementation issues are parallel — they touch disjoint primary files. The single integration issue (lock threshold to 5) is blocked on all implementation issues.
Child issues
- EPAC-1984 — Fetch.swift (worst: 20, 6 violations)
- EPAC-1985 — ContentView.swift deep-link (worst: 16, 2 violations)
- EPAC-1986 — BillsService.swift (worst: 16, 1 violation)
- EPAC-1987 — XMLBro.swift (worst: 14, 2 violations)
- EPAC-1988 — LobbyistService.swift (worst: 13, 3 violations)
- EPAC-1989 — Expenditures+CSV.swift (worst: 13, 2 violations)
- EPAC-1990 — CalendarExportService.swift (worst: 12, 2 violations)
- EPAC-1991 — SearchViewModel.swift (worst: 10, 1 violation)
- EPAC-1992 — MyMPView.swift (worst: 10, 1 violation)
- EPAC-1993 — 5 small service files (worst: 8, 6 violations)
- EPAC-1994 — BugTests.swift / parsePerson (worst: 12, 2 violations)
- EPAC-1995 — City council parsers (worst: 6, 2 violations)
- EPAC-1996 — Lock threshold:
.swiftlint.ymlerror: 50 → 5 (integration) - EPAC-1997 — Human handoff: verify CI green, update CLAUDE.md
Success metrics
swiftlint --strictreports zerocyclomatic_complexityviolations..swiftlint.ymlerrorthreshold is 5.- CI SwiftLint job passes on
main.