Skip to content

Drop SwiftFormat SPM dep so it stops leaking to consumers (#214) - #215

Merged
pietbrauer merged 1 commit into
mainfrom
fix/214-drop-swiftformat-dep
Jul 19, 2026
Merged

Drop SwiftFormat SPM dep so it stops leaking to consumers (#214)#215
pietbrauer merged 1 commit into
mainfrom
fix/214-drop-swiftformat-dep

Conversation

@pietbrauer

@pietbrauer pietbrauer commented Jul 19, 2026

Copy link
Copy Markdown
Member

Summary

  • Removes SwiftFormat from Package.swift / Package.resolved so consumers of OctoKit no longer inherit it as a transitive SPM checkout.
  • Switches the CI lint job to run swiftformat --lint . inside the official ghcr.io/nicklockwood/swiftformat:0.52.8 container instead of the swift package plugin swiftformat invocation (which required the dep).
  • Adds a short Formatting section to README.md telling contributors to install SwiftFormat via brew or mint and run swiftformat . locally.

Fixes #214.

Why

SPM propagates every package-level dependency to consumers even when no target links against it, so downstream apps and CLI tools were paying the extra clone/build/disk cost for a formatter they never use. SwiftFormat was only ever referenced by the CI lint step — no target lists it as a dependency or plugin — so it can safely leave the manifest.

Swift 5.10 has no package traits, so an "optional" dep isn't available; running the tool out-of-band in CI is the cleanest fix.

Test plan

  • swift package resolvePackage.resolved no longer pins SwiftFormat.
  • swift build — library builds clean.
  • swift test --enable-test-discovery — 208 tests pass.
  • cd OctoKitCLI && swift build — CLI builds clean.
  • swiftformat --lint . locally — 0/22 files require formatting.
  • CI green on the new lint job (ghcr.io/nicklockwood/swiftformat:0.52.8).
  • Consumer sanity check: point a scratch SPM package at this branch and confirm no SwiftFormat checkout appears under .build/checkouts.

Fixes #214. SwiftFormat was declared as a top-level package dependency
purely to power the CI lint plugin, but SPM propagates package-level
deps to consumers even when no target links against them. Downstream
apps and CLI tools paid the extra clone/build/disk cost for a tool
they never use.

Remove the SwiftFormat dependency from Package.swift (and Package.resolved)
and switch the CI lint job to the official ghcr.io/nicklockwood/swiftformat
container image, which invokes the binary directly. README gains a
Formatting section pointing contributors at brew/mint for local installs.
@pietbrauer
pietbrauer merged commit b4ac587 into main Jul 19, 2026
4 checks passed
@pietbrauer
pietbrauer deleted the fix/214-drop-swiftformat-dep branch July 19, 2026 19:06
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.

Avoid propagating SwiftFormat dependency

1 participant