SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

SwiftLint format with Swift 6.1 trailing commas feature changes closing parenthesis indentation

Open ebgraham opened this issue 7 months ago • 4 comments

New Issue Checklist

Bug Description

When using the new Swift 6.1 support for trailing commas, SwiftLint indents the closing parenthesis rather than keep it at the expected non-indented level.

// with trailing comma
let a = CGRect(
    x: 0,
    y: 0,
    width: 100,
    height: 100,
    )
// without trailing comma
let a = CGRect(
    x: 0,
    y: 0,
    width: 100,
    height: 100
)

Environment

  • SwiftLint version 0.59.0
  • Xcode version (n/a)

ebgraham avatar Apr 15 '25 14:04 ebgraham

Which command are you running and what is the configuration in use?

SimplyDanny avatar Apr 15 '25 15:04 SimplyDanny

Which command are you running and what is the configuration in use?

using swiftlint --fix --format with an empty configuration file.

ebgraham avatar Apr 15 '25 15:04 ebgraham

I can repro this

mildm8nnered avatar Apr 19 '25 23:04 mildm8nnered

I'm interested in taking a look at this issue. Is anyone currently assigned to it or actively working on it? Thanks!

Marvae avatar May 13 '25 12:05 Marvae

SwiftLint is entirely relying on SourceKit to format code. With the Swift 6.1.2 toolchain that comes bundled with Xcode 16.4 I see the behavior, too. This is an upstream issue we cannot fix in SwiftLint.

SimplyDanny avatar Jul 02 '25 21:07 SimplyDanny