When returning a closure without a return statement, as it's possible since Swift 5.1, the opening brace rule reports a false positive.
/// hello
public var closure: () -> Void {
{
print("hello")
}
}
is autocorrected to
/// hello
public var closure: () -> Void { {
print("hello")
}
}
$ swiftlint lint --no-cache test.swift
Linting Swift files at paths test.swift
Linting 'test.swift' (1/1)
/Users/tom/test.swift:3:5: warning: Opening Brace Spacing Violation: Opening braces should be preceded by a single space and on the same line as the declaration. (opening_brace)
Done linting! Found 1 violation, 0 serious in 1 file.
swiftlint version to be sure)?0.35.0
Homebrew
xcode-select -p)?11.1
echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rulesswiftlint lint --path [file here] --no-cache --enable-all-rules.see above
Also linking adding support for implicit returns here: https://github.com/realm/SwiftLint/issues/2870
The corrected code looks fine.
could this at least be made configurable?
This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions!