Swiftlint: False positives when using let_var_whitespace with string interpolation

Created on 22 May 2019  路  2Comments  路  Source: realm/SwiftLint

New Issue Checklist

Describe the bug

False positives when using let_var_whitespace with string interpolation.

swiftlint version  
0.32.0

.swiftlint.yml

whitelist_rules:
  - let_var_whitespace

main.swift
(maybe, false positive)

let a = "\(1)"
private let b = "" // Variable Declaration Whitespace Violation: Let and var should be separated from other statements by a blank line. (let_var_whitespace)

If I remove string interpolation from the code, no violation found.

let a = ""
private let b = "" // OK

Or removing private from second line is also no violation.

let a = "\(1)"
let b = "" // OK
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
Loading configuration from '.swiftlint.yml'
Linting Swift files at paths 
Linting 'main.swift' (1/1)
/path/to/main.swift:2:1: 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 file.

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.32.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? homebrew
  • Paste your configuration file:
whitelist_rules:
  - let_var_whitespace
SourceKit issue bug

Most helpful comment

Looks like this was fixed as part of Swift 5.1 馃挴

All 2 comments

This is caused by a SourceKit bug: https://github.com/realm/SwiftLint/pull/2720#issuecomment-483112662

Looks like this was fixed as part of Swift 5.1 馃挴

Was this page helpful?
0 / 5 - 0 ratings