I have adopted the new Swift 5.1 property wrapper feature. It seems to cause a false positive with the opt-in rule let_var_whitespace.
Relevant file:
import Foundation
public enum Defaults {
@UserDefault("isFirstTimeUser", defaultValue: true)
public static var isFirstTimeUser: Bool
}
$ swiftlint lint --config ../.swiftlint.yml
Loading configuration from '../.swiftlint.yml'
Linting Swift files at paths
Linting 'Defaults.swift' (1/1)
<path>/Defaults.swift:6:5: warning: Variable Declaration Whitespace Violation: Let and var should be separated from other statements by a blank line. (let_var_whitespace)
Done linting! Found 1 violation, 0 serious in 1 files.
swiftlint version to be sure)? 0.37.0opt_in_rules:
- let_var_whitespace
echo "public enum Defaults {
@UserDefault("isFirstTimeUser", defaultValue: true)
public static var isFirstTimeUser: Bool
}" | swiftlint lint --no-cache --use-stdin --enable-all-rules
What is the status of this? Is anybody working on it?
I've found that this can be avoided by adding a doc comment above the property wrapper. Still rather annoying.
Adding a +1 here and really appreciative of the workaround @jshier !
+++
The same
+1
Also, another workaround would be to have the property wrapper in the same line as the variable definition, something like:
@Inject var foo: Foo
If anyone here has started working on this and has hit a dead end, I'm happy to help answer any questions you might have.
The CONTRIBUTING.md doc should be a good first step in looking into making changes to SwiftLint.
Most helpful comment
I've found that this can be avoided by adding a doc comment above the property wrapper. Still rather annoying.