ktlint
ktlint copied to clipboard
Properties that start with `_` should be suppressed by `PropertyName`
Expected Behavior
No errors are thrown.
Observed Behavior
ktlint Foo.kt
/Users/goooler/StudioProjects/DemoApp/adapter/src/main/kotlin/io/goooler/demoapp/adapter/rv/core/Foo.kt:4:17: Backing property not allowed when 'private' modifier is missing (standard:backing-property-naming)
/Users/goooler/StudioProjects/DemoApp/adapter/src/main/kotlin/io/goooler/demoapp/adapter/rv/core/Foo.kt:4:17: Backing property is only allowed when a matching property or function exists (standard:backing-property-naming)
Summary error count (descending) by rule:
standard:backing-property-naming: 2
Steps to Reproduce
Foo.kt:
open class Foo {
@Suppress("PropertyName")
protected val _bar = mutableListOf<String>()
}
Run ktlint Foo.kt.
Context
Related to:
- #2332
- #2612
Your Environment
- Version of ktlint used: CLI 1.3.0
@Suppress(PropertyName) currently only suppresses the property-naming rule (code).