Skip to content

Periphery Analysis Results - Additional Unused Code Cleanup Needed #231

@DrunkOnJava

Description

@DrunkOnJava

Summary

Completed initial Periphery static analysis to identify unused code in the codebase. While we successfully resolved the major compilation issues and cleaned up some unused code, additional cleanup is needed.

Completed Work

  • ✅ Fixed major compilation errors (CoreModels imports, OCRResult types, method signatures)
  • ✅ Removed unused Preview structs in AnalyticsHomeView
  • ✅ Features-Analytics module now builds successfully
  • ✅ Implemented complete MockReceiptRepository with all protocol methods

Periphery Analysis Findings

The analysis identified several categories of unused code:

Successfully Cleaned Up

  • AnalyticsHomeView_Previews - Removed unused preview struct
  • CoreModels import dependencies - Fixed in multiple files

Still Needs Cleanup

Based on periphery-scan-results.txt, the following items were identified as unused:

  • Additional OCRResult references in DocumentScannerView.swift
  • Various properties and methods marked as unused but may be false positives
  • Preview-related warnings that need @Previewable annotations

Files Generated

  • periphery-scan-results.txt - Main analysis results
  • periphery-report.csv - Structured data for further analysis
  • unused-code-report.txt - Comprehensive unused code analysis
  • TODO-periphery-cleanup.md - Action items for cleanup

Next Steps

  1. Continue fixing remaining OCRResult type errors in other files
  2. Review Periphery findings for false positives vs actual unused code
  3. Implement remaining protocol method fixes
  4. Add @Previewable annotations where needed
  5. Consider running Periphery analysis periodically as part of CI

Related Issues

  • Related to overall codebase cleanup and maintenance
  • Part of ongoing effort to reduce technical debt
  • Supports build reliability improvements

Technical Notes

  • Periphery v3.1.0 used for analysis
  • Analysis run on full codebase with build-for-testing target
  • Some warnings may be SwiftUI-related false positives due to declarative nature

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenanceMaintenance tasks and technical debttech-debtTechnical debt that needs addressing

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions