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
As closure_end_indentation's description states, a closure end should have the same indentation as the line that started it, but this behavior conflicts with Xcode's indentation (^i) and SwiftLint's --format.
Below, a sample .swiftlint.yml file with the rule enabled, a swift file - file.swift - with one of the examples from swiftlint rules closure_end_indentation and the output, showing that the code is correct (closure ending with correct indentation, as imposed by the rule).
$ cat .swiftlint.yml
opt_in_rules:
- closure_end_indentation
$ cat file.swift
SignalProducer(values: [1, 2, 3])
.startWithNext { number in
print(number)
}
$ swiftlint lint
Loading configuration from '.swiftlint.yml'
Linting Swift files at paths
Linting 'file.swift' (1/1)
Done linting! Found 0 violations, 0 serious in 1 file.
However, when the command swiftlint autocorrect --format runs, it autocorrects the file and reformats it, reverting the autocorrection applied by the rule.
$ swiftlint autocorrect --format
Loading configuration from '.swiftlint.yml'
Correcting Swift files at paths
Correcting 'file.swift' (1/1)
Done correcting 1 file!
$ cat file.swift
SignalProducer(values: [1, 2, 3])
.startWithNext { number in
print(number)
}
As result, autocorrect has to run twice - first to format and then to correct the files -, adding a undesired delay to the build phase:
New Issue Checklist
Bug Report
As
closure_end_indentation
's description states, a closure end should have the same indentation as the line that started it, but this behavior conflicts with Xcode's indentation (^i) and SwiftLint's--format
.Below, a sample
.swiftlint.yml
file with the rule enabled, a swift file -file.swift
- with one of the examples fromswiftlint rules closure_end_indentation
and the output, showing that the code is correct (closure ending with correct indentation, as imposed by the rule).However, when the command
swiftlint autocorrect --format
runs, it autocorrects the file and reformats it, reverting the autocorrection applied by the rule.As result,
autocorrect
has to run twice - first to format and then to correct the files -, adding a undesired delay to the build phase:Ideally
swiftlint autocorrect --format
should first format and then autocorrect the files.Environment
swiftlint version
to be sure)?master
swift build
xcode-select -p
)? 9.4.1The text was updated successfully, but these errors were encountered: