Duplicated Key in Dictionary Literal Violation
does not understand #line
directive. #4012
Closed
Description
New Issue Checklist
- [ x] Updated SwiftLint to the latest version
- [ x] I searched for existing GitHub issues
Describe the bug
Duplicated Key in Dictionary Literal Violation
does not understand #line
directive.
Complete output when running SwiftLint, including the stack trace and command used
➜ swiftlint lint test.swift
Linting Swift files at paths test.swift
Linting 'test.swift' (1/1)
/Users/nils_kunze/work/misc/test.swift:1:14: warning: Colon Spacing Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)
/Users/nils_kunze/work/misc/test.swift:3:5: warning: Duplicated Key in Dictionary Literal Violation: Dictionary literals with duplicated keys will crash in runtime. (duplicated_key_in_dictionary_literal)
/Users/nils_kunze/work/misc/test.swift:4:5: warning: Duplicated Key in Dictionary Literal Violation: Dictionary literals with duplicated keys will crash in runtime. (duplicated_key_in_dictionary_literal)
/Users/nils_kunze/work/misc/test.swift:5:5: warning: Duplicated Key in Dictionary Literal Violation: Dictionary literals with duplicated keys will crash in runtime. (duplicated_key_in_dictionary_literal)
Done linting! Found 4 violations, 0 serious in 1 file.
Environment
-
SwiftLint version (run
swiftlint version
to be sure)? 0.47.1 -
Installation method used (Homebrew, CocoaPods, building from source, etc)? brew
-
Paste your configuration file: None / defrault
-
Are you using nested configurations? no
-
Which Xcode version are you using (check
xcodebuild -version
)? - -
Do you have a sample that shows the issue? Run
echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
to quickly test if your example is really demonstrating the issue. If your example is more
complex, you can useswiftlint lint --path [file here] --no-cache --enable-all-rules
.
var values: [Int : String] = [
#line: "one",
#line: "two",
#line: "three",
#line: "four"
]