Overview › Code Quality & Maintainability
Code Quality & Maintainability
Modern Swift, but 28 TODO markers and 108 Obj-C legacy files create maintenance drag.
70
SCORE
Summary
New Swift code is largely idiomatic, but the codebase carries known smells: 28 TODO/FIXME markers, hardcoded hex colors despite a design-token system, and 30+ print() statements in production paths. Naming and structure are consistent in newer SPM packages; older Obj-C areas show their age.
Code-quality signals (current vs target)
| Signal | Today | Target |
|---|---|---|
Force-unwrap (!) usage | Pervasive | SwiftLint force_unwrapping error severity, sweep over 1 quarter |
Force-try (try!) usage | 13+ critical sites | 0 in non-test code |
Force-cast (as!) usage | Widespread | SwiftLint force_cast error severity |
| Hardcoded hex colors | Common | Custom SwiftLint rule banning hex outside design system |
| print() in production | 30+ | 0 outside #if DEBUG |
| TODO markers | 28 | Each linked to a tracked issue |
| File length | Unknown | SwiftLint file_length: 500 |
| Function body length | Unknown | SwiftLint function_body_length: 60 |
| Cyclomatic complexity | Unknown | SwiftLint cyclomatic_complexity: 15 |
Recommended SwiftLint configuration (excerpt)
opt_in_rules:
- force_unwrapping
- force_cast
- implicit_return
- missing_docs
- explicit_init
- first_where
- sorted_first_last
- vertical_whitespace_closing_braces
disabled_rules: []
force_unwrapping:
severity: error
force_try:
severity: error
custom_rules:
no_print_in_release:
name: "print() in production"
regex: "^[^/]*print\\("
match_kinds: [identifier]
severity: warning
no_hex_color_outside_design_system:
name: "Hardcoded hex color"
regex: "Color\\(hex:|UIColor\\(hex:|init\\(hex:"
excluded: ".*CostcoDesignSystem.*"
severity: warning
Findings
""HIGH
Force-unwrap pattern is widespread
Pervasive use of
! on optionals, try! on throwing calls, as! on casts. Each is a latent crash; the most concerning are the 13 try! regex compilations and 18 URL(string:)! force-unwraps in BazaarVoice client.Recommendation: Enable SwiftLint rules
force_unwrapping, force_try, force_cast; fix violations on changed files in PR.HIGH
Hardcoded hex colors despite design system
CostcoDesignSystem ships PalletUIKit + Pallet SwiftUI tokens, but feature code commonly uses Color(hex: "#...") or UIColor(hex: 0x...) inline.Recommendation: Custom SwiftLint rule banning hex initializers outside the design-system package; sweep existing literals into tokens.
MEDIUM
print() leaks to console in production
DMCWidget, OffersTestUtilities (used in production widget), test snapshot demos all
print() directly. print() always writes regardless of build configuration.Recommendation: Adopt
os.Logger with categorized signposts; gate raw print by #if DEBUG.MEDIUM
TODO markers in long-lived code
28 TODOs identified — including "temporary solution" notes that have outlived multiple releases (TranslationProvider, SavingsPageAnalytics, GridMenu).
Recommendation: Convert each TODO to a tracked issue with owner + due date; SwiftLint rule
todo + reviewer rejection of unattributed TODOs.LOWFilename typo:
Filename typo: DitigalCardDTOMapperTest.kt equivalent
Search the iOS test tree for similar typos in filenames — they tend to compound.
Recommendation: Rename misspelled files (and fix any reference imports).
Findings in this category
Costco iOS · Code Review Report · Generated 2026-05-07 · 88 machine-curated findings