Overview › Static Analysis & Lint

Static Analysis & Lint

SwiftLint integrated via CocoaPods — verify rules are enforced on every PR.

0 findings in this category · iOS
70
SCORE

Summary

SwiftLint integrated via CocoaPods. NowSecure runs in CI (azure-pipeline-nowsecure.yml). No published lint baseline; rule enforcement strictness unclear.

Static-analysis tool stack

ToolPurposeStatus
SwiftLintStyle + opinion-based rulesPRESENT (Pod)
SwiftFormatAuto-formatting on save / pre-commitVERIFY
NowSecureMobile security scan in CIPRESENT
PeripheryDead-code detectionRECOMMEND
SwiftLint custom rulesProject-specific bans (hex outside DS, print outside DEBUG)RECOMMEND
Xcode Static AnalyzerBuilt-in — flags retain cycles, dead storesRUN PERIODICALLY
Coverage gatingBlock PRs that drop changed-file coverageRECOMMEND

Recommended SwiftLint custom rules

# .swiftlint.yml — custom_rules section

custom_rules:
  no_print_in_release:
    name: "Forbid print() outside #if DEBUG"
    regex: "^\\s*print\\("
    severity: warning

  no_hex_color_outside_design_system:
    name: "Hardcoded hex color"
    regex: "Color\\(hex:|UIColor\\(hex:"
    excluded:
      - ".*CostcoDesignSystem.*"
    severity: warning

  no_force_try_in_production:
    name: "Forbid try!"
    regex: "try!"
    excluded:
      - ".*Tests.*"
      - ".*UITests.*"
    severity: error

  no_force_unwrap_url:
    name: "URL force-unwrap"
    regex: "URL\\(string:.*\\)!"
    severity: error

CI integration

Wire each tool into Azure Pipelines:

Findings

""
PASS

SwiftLint + NowSecure

SwiftLint integrated; NowSecure mobile security scans run separately.
MEDIUM

No published .swiftlint.yml baseline

Without a published baseline, lint findings are background noise.
Recommendation: Generate a baseline; treat error-severity rules as build-breakers; review baseline diff per PR.
MEDIUM

Custom rules opportunity

SwiftLint supports custom regex rules.
Recommendation: Add custom rules for: hex literals outside design system, print outside DEBUG, force-unwrap in non-test code, NSLocalizedString with empty comment.
LOW

Adopt periphery for dead code

Periphery finds unused code in Swift projects.
Recommendation: Run quarterly; commit deletions in batches.
No findings logged in this category yet for iOS.
Costco iOS · Code Review Report · Generated 2026-05-07 · 88 machine-curated findings