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
Sandbox.kt:8:13 Backing property not allowed when 'private' modifier is missing (cannot be auto-corrected)
Sandbox.kt:8:13 Backing property is only allowed when a matching property or function exists (cannot be auto-corrected)
Sandbox.kt:14:9 Backing property not allowed when 'private' modifier is missing (cannot be auto-corrected)
Sandbox.kt:14:9 Backing property is only allowed when a matching property or function exists (cannot be auto-corrected)
it seems that local variables are treated as properties.
Steps to Reproduce
Your Environment
Version of ktlint used: 1.3.1
Relevant parts of the .editorconfig settings : no settings
Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): Ktlint Gradle plugin 12.1.1
Version of Gradle used (if applicable): 8.10
Operating System and version: Windows 11
The text was updated successfully, but these errors were encountered:
it seems that local variables are treated as properties.
From the perspective of the Kotlin Parser, the local variable is indeed a property:
It seems that your expectation is that the @Suppress("LocalVariableName") would also supress the ktlint violation. This is a small fix which makes sense to me.
Until this is implemented, you can suppress the ktlint violation explicitly:
@Suppress("LocalVariableName", "ktlint:standard:backing-property-naming")
fun test() {
val _test = "test"
println(_test)
}
Expected Behavior
This code should not have any lint errors.
Observed Behavior
This code reports the following lint errors:
it seems that local variables are treated as properties.
Steps to Reproduce
Your Environment
.editorconfig
settings : no settingsThe text was updated successfully, but these errors were encountered: