Deprecate `inert_defer` rule in favor of the Swift compiler warning (#4618)
This commit is contained in:
parent
eda0d92f44
commit
c740da48d5
|
@ -7,6 +7,11 @@
|
||||||
[Cyberbeni](https://github.com/Cyberbeni)
|
[Cyberbeni](https://github.com/Cyberbeni)
|
||||||
[#4656](https://github.com/realm/SwiftLint/issues/4656)
|
[#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
|
#### Experimental
|
||||||
|
|
||||||
* None.
|
* None.
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
import SwiftSyntax
|
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)
|
var configuration = SeverityConfiguration(.warning)
|
||||||
|
|
||||||
init() {}
|
init() {}
|
||||||
|
@ -77,7 +89,8 @@ struct InertDeferRule: ConfigurationProviderRule, SwiftSyntaxRule {
|
||||||
)
|
)
|
||||||
|
|
||||||
func makeVisitor(file: SwiftLintFile) -> ViolationsSyntaxVisitor {
|
func makeVisitor(file: SwiftLintFile) -> ViolationsSyntaxVisitor {
|
||||||
Visitor(viewMode: .sourceAccurate)
|
warnDeprecatedOnce()
|
||||||
|
return Visitor(viewMode: .sourceAccurate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue