Allow prefer_key_paths to ignore identity closures ({ $0 })#6068
Conversation
Generated by 🚫 Danger |
SimplyDanny
left a comment
There was a problem hiding this comment.
Looks good in general. Thanks!
Please see my comments and rebase your branch to make all tests run (there are relevant fixes on main).
| identifier: "prefer_key_path", | ||
| name: "Prefer Key Path", | ||
| description: "Use a key path argument instead of a closure with property access", | ||
| description: """ |
There was a problem hiding this comment.
Let's keep the existing description as it's currently also used as the violation message and add a rational property instead to explain this detail.
0b22e4f to
cbf90c0
Compare
|
Ready for re-review @SimplyDanny Not sure what is causing the buildkite/swiftlint/bazel and buildkite/swiftlint/registration CI steps to fail, as I ran both command sequences locally and they succeed. They seem to be linker issues caused by some TSan symbols, so perhaps caused by some caching issue? Thanks 🙏🏼 |
SimplyDanny
left a comment
There was a problem hiding this comment.
I found a few more stylistic issue. Other than that, it looks good!
Source/SwiftLintBuiltInRules/Rules/Idiomatic/PreferKeyPathRule.swift
Outdated
Show resolved
Hide resolved
Source/SwiftLintBuiltInRules/Rules/Idiomatic/PreferKeyPathRule.swift
Outdated
Show resolved
Hide resolved
Add new `ignore_identity_closures` parameter to `prefer_key_paths` rule
to skip conversion of identity closures (`{ $0 }`) to identity key
paths (`\self`).
Add a small note to the rule description stating that identity key path
conversion is Swift 6+ only.
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
ca999dc to
86890ba
Compare
Add new
ignore_identity_closuresparameter toprefer_key_pathsrule to skip conversion of identity closures ({ $0 }) to identity key paths (\self).Add a small note to the rule description stating that identity key path conversion is Swift 6+ only.