Overview › Code Quality & Maintainability

Code Quality & Maintainability

Modern Swift, but 28 TODO markers and 108 Obj-C legacy files create maintenance drag.

5 findings in this category · iOS
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)

SignalTodayTarget
Force-unwrap (!) usagePervasiveSwiftLint force_unwrapping error severity, sweep over 1 quarter
Force-try (try!) usage13+ critical sites0 in non-test code
Force-cast (as!) usageWidespreadSwiftLint force_cast error severity
Hardcoded hex colorsCommonCustom SwiftLint rule banning hex outside design system
print() in production30+0 outside #if DEBUG
TODO markers28Each linked to a tracked issue
File lengthUnknownSwiftLint file_length: 500
Function body lengthUnknownSwiftLint function_body_length: 60
Cyclomatic complexityUnknownSwiftLint 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.
LOW

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

5 shown
Costco iOS · Code Review Report · Generated 2026-05-07 · 88 machine-curated findings