Skip to content

Remove dead code - #95

Merged
dadachi merged 1 commit into
mainfrom
cleanup/dead-code
Oct 13, 2026
Merged

dadachi merged 1 commit into
mainfrom
cleanup/dead-code

Conversation

@dadachi

@dadachi dadachi commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Phase 3 (dead-code removal). Candidates came from a Periphery 3.8 scan of the app and test targets, built into a separate DerivedData. Each one was then checked with git grep, including string-based uses in Info.plist, the xcstrings catalogs and the pbxproj. Nothing here changes behavior.

Removed

  • Unused semantic colors (30), each with its ShapeStyle accessor. These are the same 26 that the paid edition removed in #114 of NativeAppTemplate-iOS, plus the background and foreground colors for the personal and current-account tags. Free has no such tags. The 10-step palette scales are left whole.

  • TagView: borderColor was passed by both tags but never drawn, and the size preference measured a height that was never read. SnackbarState.Status.color is also gone.

  • Unused constants: NativeAppTemplateConstants.Animation; Strings.no/close/open/instructions/role/createShop; Font.uiLargeTitle; UIFont+Extensions.swift (the file and its 4 pbxproj entries).

  • shopLimitCount in SessionControllerProtocol, NullSessionController and TestSessionController. Nothing read it through the protocol. SessionController keeps its own property, because its shopkeeper didSet and fetchPermissions use it to tell that the permissions are loaded.

  • Unused parameters:

    • id on UpdateShopkeeperRequest, SignUpsService.updateShopkeeper and SignUpRepository(Protocol).update. The PATCH path is /shopkeeper_auth, and the id was never in the path or the body.
    • shop on ShopDetailView.header/shopDetailView.
  • Unused view-model dependencies:

    • sessionController on ItemTagDetailViewModel, ItemTagListViewModel and ShopBasicSettingsViewModel;
    • itemTagRepository on ShopSettingsViewModel.

    They were stored and never read. The call sites and tests are updated to match.

  • Other unused members:

    • ShopDetailViewModel.isLoggedIn;
    • ItemTagRepository(Protocol).isEmpty and its test doubles;
    • Shopkeeper's private copy init(shopkeeper:);
    • both JSONAPIResource subscripts;
    • Keychain.string(for:) and Keychain.set(_: String, for:);
    • TestSignUpRepository.lastUpdateId;
    • test fixtures that no test used (in ShopList, ShopBasicSettings, ShopSettings, ItemTagDetail and ItemTagList tests).
  • Noise: the KeychainStore.store debug log, the commented-out Tips.showAllTipsForTesting(), and a commented-out typealias in GetShopDetailRequest.

  • Localizable.xcstrings: removed Close, Create Shop, Instructions, No, Open and Role. I checked this by comparing the catalog against every key in the app target's .stringsdata after building. No code key is missing from the catalog.

  • .swiftlint.yml: removed the excluded paths, which sit outside included: NativeAppTemplate, and the unused identifier_name exceptions by/db.

Checked and left alone

  • Idled/Completed catalog keys are stale, but LocalizationTest.japaneseSpotCheck uses them as glossary anchors, so they stay.
  • fetchPermissions writes the unchanged shopkeeper back to the keychain. This isn't a no-op: Keychain.set runs SecItemUpdate with kSecAttrAccessibleAfterFirstUnlock, so it re-applies the accessibility attribute to items from older versions. A write failure also sets permissionState = .error. Left as is.
  • DataCacheUpdate, EntityRelationship and the adapters' relationships/cacheUpdate parameters, plus JSONAPIResource.entityID/parent/meta and JSONAPIRelationship.meta/links. This is a whole unused relationship-cache layer that is shared with the paid edition. Removing it changes the EntityAdapter signature in both repos, so it's better done as one paired refactor.
  • ItemTag.shopName is assign-only, but the adapter requires shop_name. Removing it would change parsing.
  • Spacing xxl/xxxxl and CornerRadius xl are part of the documented design scale. The protocol init requirements on the repository protocols are a project convention.
  • Periphery false positives: the ScrollToTopID fields (used through Hashable), the preview's visible, and redundant public (accessibility only).
  • Unreferenced files:
    • SampleCode.xcconfig: the pbxproj sets SAMPLE_CODE_DISAMBIGUATOR itself;
    • docs/images that no file references (nfc.gif, overview_*.png, screenshots_nfc.png; social-preview.* is for the GitHub settings). These may be linked from outside, so they stay.

Checks

  • make lint: SwiftLint 0 violations, SwiftFormat 0/136 files to format.
  • Full suite on the iPhone (00008150-0019095C1A08401C): 415 tests: 408 passed, 0 failed, 6 skipped (the simulator-only catalog checks), plus 1 expected failure (WaitUntilTest's withKnownIssue).
  • No new tests, since no behavior changed.
  • Device: after the test run reinstalled the app, a temporary on-device test (not committed) signed in as the QA user. I then launched the app with devicectl. The local server logged POST /shopkeeper_auth/sign_in, GET …/permissions and GET …/shops from the phone, all 200, so local network access survived the reinstall. The app stays running.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K5hZEFqXhBsUQwSWsgR6eH

Found with a Periphery 3.8 scan of the app and test targets, each
candidate checked with git grep (incl. Info.plist, xcstrings, pbxproj).
No behavior changes.

- 30 unused semantic colors and their ShapeStyle accessors
- TagView's never-drawn borderColor and its unread size preference;
  SnackbarState.Status.color
- unused constants (Animation, Strings.no/close/open/instructions/role/
  createShop), Font.uiLargeTitle and UIFont+Extensions.swift
- shopLimitCount from SessionControllerProtocol (SessionController keeps
  it; it marks the permissions as loaded)
- the unused id parameter of the shopkeeper update chain
- unused dependencies: sessionController of ItemTagDetail/ItemTagList/
  ShopBasicSettings view models, itemTagRepository of ShopSettings
- ShopDetailView's unused shop parameters, ShopDetailViewModel.isLoggedIn
- ItemTagRepository.isEmpty, Shopkeeper's private copy init, the
  JSONAPIResource subscripts, Keychain's string helpers
- the KeychainStore.store debug log and commented-out code
- stale Localizable.xcstrings keys, .swiftlint.yml leftovers
- unused test fixtures

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5hZEFqXhBsUQwSWsgR6eH
@dadachi
dadachi merged commit 92e4657 into main Oct 13, 2026
2 checks passed
@dadachi
dadachi deleted the cleanup/dead-code branch October 13, 2026 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant