SwiftLint: False positive: let_var_whitespace with Swift 5.1 property wrappers

New Issue Checklist

Describe the bug

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
}
Complete output when running SwiftLint, including the stack trace and command used
$ 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.

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.37.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? Homebrew
  • Paste your configuration file:
opt_in_rules:
  - let_var_whitespace
  • Are you using nested configurations? No
  • Which Xcode version are you using? 11.2.1
  • Do you have a sample that shows the issue?
echo "public enum Defaults {
@UserDefault("isFirstTimeUser", defaultValue: true)
public static var isFirstTimeUser: Bool
}" | swiftlint lint --no-cache --use-stdin --enable-all-rules

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 25
  • Comments: 22 (3 by maintainers)

Most upvoted comments

I’ve found that this can be avoided by adding a doc comment above the property wrapper. Still rather annoying.

What is the status of this? Is anybody working on it?

Could you please create another issue for your finding, @MrCOBA? I don’t think it is related.