Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properties that start with _ should be suppressed by PropertyName #2714

Closed
Goooler opened this issue Jun 25, 2024 · 1 comment · Fixed by #2741
Closed

Properties that start with _ should be suppressed by PropertyName #2714

Goooler opened this issue Jun 25, 2024 · 1 comment · Fixed by #2741
Milestone

Comments

@Goooler
Copy link
Contributor

Goooler commented Jun 25, 2024

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:

Your Environment

  • Version of ktlint used: CLI 1.3.0
@paul-dingemans
Copy link
Collaborator

@Suppress(PropertyName) currently only suppresses the property-naming rule (code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants