Skip to content

swiftlint opening_brace rule conflicts with swiftformat wrapMultilineStatementBraces (breaks CI) #708

@malpern

Description

@malpern

Problem

swiftlint --fix and the pinned swiftformat disagree on multiline-statement braces:

  • swiftformat's wrapMultilineStatementBraces wants the opening { on its own line.
  • swiftlint's opening_brace rule collapses it onto the condition line.

The swiftformat fixed-point is the CI gate (code-quality job → "SwiftFormat Check"); swiftlint's opening_brace is only a non-blocking warning. So running swiftlint --fix after swiftformat silently breaks formatting and fails CI.

Impact

Hit during PR #697swiftlint --fix re-collapsed two if let … { braces in WebHelpView.swift, failing the swiftformat CI check and costing a fix-up commit + CI re-run. It will recur for anyone who runs swiftlint --fix.

Fix options

  1. Disable opening_brace in .swiftlint.yml (let swiftformat own brace style) — cleanest, one line.
  2. Document "run swiftformat last; never apply swiftlint's brace rewrites" (already a CLAUDE.md-adjacent gotcha) — weaker, relies on discipline.

Recommend option 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions