SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

Rule Request: redundant_optional_initialization as default may cause extra work with Swift 6

Open idrougge opened this issue 2 years ago • 1 comments

New Issue Checklist

New rule request

In anticipation of possible requirements to initialise all optionals explicitly, I declared a private var dataSource: UICollectionViewDataSource? = nil and ran into the redundant_optional_initialization rule. As #2785 requests, there should be an »inverted« version of that rule for those who want to minimise for possible Swift 6 migration issues.

But by having the rule enabled by default, many more users may be facing more busywork if and when Swift 6 arrives with changed rules regarding Optional initialisation, at which point the rule will have to be removed in any case for Swift 6 mode. It therefore makes sense to disable the redundant_optional_initialization by default until it can be expected that the rule will not run afoul of the language's own rules in the near future.

idrougge avatar Jun 30 '22 10:06 idrougge

In anticipation of possible requirements to initialise all optionals explicitly ...

Would you like to share a pointer to the Evolution Proposal or other sources potentially leading to this requirement?

SimplyDanny avatar Jun 30 '22 16:06 SimplyDanny