Skip to content

Disable wrapIfStatementBodies to match the repo's inline style - #358

Closed
bguidolim wants to merge 1 commit into
mainfrom
bruno/CHORE-swiftformat-wrap-if-bodies
Closed

Disable wrapIfStatementBodies to match the repo's inline style#358
bguidolim wants to merge 1 commit into
mainfrom
bruno/CHORE-swiftformat-wrap-if-bodies

Conversation

@bguidolim

Copy link
Copy Markdown
Collaborator

Summary

A clean main currently fails swiftformat --lint --strict . on 20 files, 109 violations, all from a single rule. Newer SwiftFormat releases wrap single-line if 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 swiftformat runs rewriting unrelated lines in every file they touch.

Changes

  • Adds wrapIfStatementBodies to the existing --disable list in .swiftformat, alongside wrapMultilineStatementBraces. Combined onto one comma-separated directive so there is no ambiguity about whether a second --disable line accumulates or overrides.

Test plan

  • swift test passes locally
  • swiftformat --lint . and swiftlint pass without violations — 0/138 files require formatting (was 20), SwiftLint 0 violations
  • Affected commands verified with a real pack — N/A, config-only change with no runtime effect

- 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
@bguidolim

Copy link
Copy Markdown
Collaborator Author

Folded into #357 — the format fix rides along with the doctor change rather than landing separately.

@bguidolim bguidolim closed this Jul 28, 2026
@bguidolim
bguidolim deleted the bruno/CHORE-swiftformat-wrap-if-bodies branch July 28, 2026 21:47
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