-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new type-safe ArrayInitRule #3914
Add new type-safe ArrayInitRule #3914
Conversation
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always great to see more analyzer rules!
Source/SwiftLintFramework/Rules/Lint/TypesafeArrayInitRule.swift
Outdated
Show resolved
Hide resolved
Source/SwiftLintFramework/Rules/Lint/TypesafeArrayInitRule.swift
Outdated
Show resolved
Hide resolved
Source/SwiftLintFramework/Rules/Lint/TypesafeArrayInitRule.swift
Outdated
Show resolved
Hide resolved
import Foundation | ||
import SourceKittenFramework | ||
|
||
public struct TypesafeArrayInitRule: AnalyzerRule, ConfigurationProviderRule, OptInRule, AutomaticTestableRule { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All analyzer rules are opt-in
public struct TypesafeArrayInitRule: AnalyzerRule, ConfigurationProviderRule, OptInRule, AutomaticTestableRule { | |
public struct TypesafeArrayInitRule: AnalyzerRule, ConfigurationProviderRule, AutomaticTestableRule { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether redundant protocol conformances could be flagged by yet another analyzer rule. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big deal, just redundant. I think a pre-typechecked lint rule would be sufficient though.
Feel free to merge after you've considered my feedback. |
The idea of this new Analyzer rule is to filter the calls of `map` before they are passed on to the classic ArrayInitRule which does the detailed checking of the lambda function block. The rule makes sure that only the `map` function is considered that is defined by the `Sequence` protocol.
c913a13
to
57bd3b3
Compare
The idea of this new Analyzer rule is to filter the calls of `map` before they are passed on to the classic ArrayInitRule which does the detailed checking of the lambda function block. The rule makes sure that only the `map` function is considered that is defined by the `Sequence` protocol.
The idea of this new Analyzer rule is to filter the calls of
map
before they are passed on to the classic ArrayInitRule which does the detailed checking of the lambda function block. The rule makes sure that only themap
function is considered that is defined by theSequence
protocol.This new rule provides a fix for #3749.