Disable wrapIfStatementBodies to match the repo's inline style - #358
Closed
bguidolim wants to merge 1 commit into
Closed
Disable wrapIfStatementBodies to match the repo's inline style#358bguidolim wants to merge 1 commit into
bguidolim wants to merge 1 commit into
Conversation
- Newer SwiftFormat releases wrap single-line `if x { return y }` bodies,
which this codebase writes inline throughout — a clean main fails
`swiftformat --lint --strict .` on 20 files under 0.62.1
- Declares the existing style in config rather than pinning the tool version,
so the check is stable across SwiftFormat upgrades
Collaborator
Author
|
Folded into #357 — the format fix rides along with the doctor change rather than landing separately. |
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
A clean
maincurrently failsswiftformat --lint --strict .on 20 files, 109 violations, all from a single rule. Newer SwiftFormat releases wrap single-lineif x { return y }bodies onto three lines; this codebase writes them inline throughout. Nothing in the repo changed — the lint job installs SwiftFormat unpinned (brew install+brew upgrade), so a new release moved the goalposts.Disabling the rule states the existing style in config, which keeps the check stable across future SwiftFormat upgrades. The alternative, pinning the tool version, would freeze the repo on an old release and still leave contributors' local
swiftformatruns rewriting unrelated lines in every file they touch.Changes
wrapIfStatementBodiesto the existing--disablelist in.swiftformat, alongsidewrapMultilineStatementBraces. Combined onto one comma-separated directive so there is no ambiguity about whether a second--disableline accumulates or overrides.Test plan
swift testpasses locallyswiftformat --lint .andswiftlintpass without violations —0/138 files require formatting(was 20), SwiftLint0 violations