You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
closure_spacing autocorrect adds a space on every --fix run when closure contains a block comment #6798
When a closure contains a block comment (/* ... */) and has more than one space before the closing brace, swiftlint --fix adds an additional space on each invocation instead of normalizing to a single space. This creates an infinite spiral — every --fix pass makes the violation worse.
This can happen naturally when swift-format reformats a closure containing a block comment, producing two spaces before }. Once in that state, swiftlint --fix never converges.
Expected: After the first --fix, the spacing should be normalized to { /* no-op */ } (single space on each side). Subsequent runs should produce no changes.
Actual: Each --fix appends one more space before }. The autocorrect reports success on every pass, but the violation is never resolved.
This may be related to the fix in PR #4584 (issues #4565 / #4582), which addressed false-positive detection for block comments in closures. The detection works correctly, but the autocorrect logic appears to unconditionally insert a space rather than replacing the existing whitespace with a single space.
Environment
SwiftLint version: 0.65.0 (also reproduced on 0.63.3)
Activity