-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
acceptable-false-positiveFalse positives caused by rules that are unavoidable due to missing type information.False positives caused by rules that are unavoidable due to missing type information.bugUnexpected and reproducible misbehavior.Unexpected and reproducible misbehavior.
Description
New Issue Checklist
- I've Updated SwiftLint to the latest version.
- I've searched for existing GitHub issues.
Bug Description
A clear and concise description of what the bug is. Ideally, provide a small (but compilable) example code snippet that
can be used to reproduce the issue.
struct MyStruct {
static var staticMember = "test"
}
let foo: [MyStruct.Type] = [MyStruct.self]
let bar = foo.map { $0.staticMember }Mention the command or other SwiftLint integration method that caused the issue. Include stack traces or command output.
$ swiftlint lintProduces test.swift:6:19: warning: Prefer Key Path Violation: Use a key path argument instead of a closure with property access (prefer_key_path)
$ SwiftLint lint --fixChanges it into
struct MyStruct {
static var staticMember = "test"
}
let foo: [MyStruct.Type] = [MyStruct.self]
let bar = foo.map(\.staticMember)Which is not valid swift code: error: key path cannot refer to static member 'staticMember'
Environment
- SwiftLint version: 0.57.0
- Xcode version: 16.0
- Installation method used: Homebrew
- Configuration file:
opt_in_rules:
- prefer_key_pathAre you using nested configurations? No
Metadata
Metadata
Assignees
Labels
acceptable-false-positiveFalse positives caused by rules that are unavoidable due to missing type information.False positives caused by rules that are unavoidable due to missing type information.bugUnexpected and reproducible misbehavior.Unexpected and reproducible misbehavior.