Drop SwiftFormat SPM dep so it stops leaking to consumers (#214) - #215
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SwiftFormatfromPackage.swift/Package.resolvedso consumers of OctoKit no longer inherit it as a transitive SPM checkout.swiftformat --lint .inside the officialghcr.io/nicklockwood/swiftformat:0.52.8container instead of theswift package plugin swiftformatinvocation (which required the dep).README.mdtelling contributors to install SwiftFormat viabrewormintand runswiftformat .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 resolve—Package.resolvedno longer pinsSwiftFormat.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.ghcr.io/nicklockwood/swiftformat:0.52.8).SwiftFormatcheckout appears under.build/checkouts.