nicklockwood / SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code
MIT License
7.63k stars 623 forks source link

A parameter is incorrectly ignored #1688

Closed RussBaz closed 1 month ago

RussBaz commented 2 months ago

The following snippet causes SwiftFormat to break the code:

func urlTestContains(path: String, strict _: Bool = true) -> Bool {
    let path = if path.hasSuffix("/") { path } else { "\(path)/" }

    return false
}

It does not detect that the path variable is used, and it will insert_ to the function signature.

I am sorry I could not describe the issue any better and could not verify if it was previously reported. Please have a look.

I am using swiftformat version 0.53.8.

Thank you.

calda commented 2 months ago

Should be fixed by https://github.com/nicklockwood/SwiftFormat/pull/1687

nicklockwood commented 1 month ago

@RussBaz fix landed in 0.53.9