Deprecate `inert_defer` rule in favor of the Swift compiler warning (#4618)

This commit is contained in:
Danny Mösch 2022-12-23 10:07:41 +01:00 committed by GitHub
parent eda0d92f44
commit c740da48d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View File

@ -7,6 +7,11 @@
[Cyberbeni](https://github.com/Cyberbeni)
[#4656](https://github.com/realm/SwiftLint/issues/4656)
* Deprecate the `inert_defer` rule in favor of the Swift compiler warning.
At the same time, make it an opt-in rule.
[SimplyDanny](https://github.com/SimplyDanny)
[#4615](https://github.com/realm/SwiftLint/issues/4615)
#### Experimental
* None.

View File

@ -1,6 +1,18 @@
import SwiftSyntax
struct InertDeferRule: ConfigurationProviderRule, SwiftSyntaxRule {
private let warnDeprecatedOnceImpl: Void = {
queuedPrintError("""
The `\(InertDeferRule.description.identifier)` rule is now deprecated and will be completely \
removed in a future release due to an equivalent warning issued by the Swift compiler.
"""
)
}()
private func warnDeprecatedOnce() {
_ = warnDeprecatedOnceImpl
}
struct InertDeferRule: ConfigurationProviderRule, SwiftSyntaxRule, OptInRule {
var configuration = SeverityConfiguration(.warning)
init() {}
@ -77,7 +89,8 @@ struct InertDeferRule: ConfigurationProviderRule, SwiftSyntaxRule {
)
func makeVisitor(file: SwiftLintFile) -> ViolationsSyntaxVisitor {
Visitor(viewMode: .sourceAccurate)
warnDeprecatedOnce()
return Visitor(viewMode: .sourceAccurate)
}
}