You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In ktlint 1.3.0 an import which is only used inside a block which is excluded from formatting, is reported as being an unused import. Removing the import results in code which can not be compiled.
import bar.Bar1
import bar.Bar2
fun foo123() {
// @formatter:off
// Assume that class Bar1 is defined in package. The import
// for this class is reported as unused
Bar1()
// @formatter:on
// Assume that class Bar1 is defined in package. The import
// // for this class is not reported as unused
Bar2()
}
The text was updated successfully, but these errors were encountered:
Imports which are only used in code blocks which are suppressed for ktlint should not be reported as unused as removal results in compilation errors.
Refactored the code so that a rule can be marked with interface `IgnoreKtlintSuppressions` to indicate that all suppression for this rule are to be ignored.
Closes#2696
Imports which are only used in code blocks which are suppressed for ktlint should not be reported as unused as removal results in compilation errors.
Refactored the code so that a rule can be marked with interface `IgnoreKtlintSuppressions` to indicate that all suppression for this rule are to be ignored.
* Refactor rebuilding suppression locator
The former SuppressionLocator lambda and object SuppressionLocatorBuilder are now replaced with the class SuppressionLocator. Upon each check whether a ASTNode has to be suppressed, it is also determined whether it is needed to rebuild the suppression hints. This is only needed when the code that is represented by the AST has been changed.
The CodeFormatter no longer has to rebuild the suppression locator after autocorrect. This responsibility is now moved into the RuleExecutionContext and SuppressionLocator itself.
Closes#2696
Based on nbadal/ktlint-intellij-plugin#535 (comment)
In ktlint
1.3.0
an import which is only used inside a block which is excluded from formatting, is reported as being an unused import. Removing the import results in code which can not be compiled.The text was updated successfully, but these errors were encountered: