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

Backing property in a companion object triggers a backing-property-naming violation #2877

Open
ygnessin opened this issue Nov 23, 2024 · 0 comments

Comments

@ygnessin
Copy link

ygnessin commented Nov 23, 2024

Thank you so much for maintaining this library and for your attention to this issue.

Is this a bug, or is it intended behavior? If intended, I can open a feature request, because I don't think this should be a violation.

Expected Behavior

no ktlint violations

Observed Behavior

Lint error > [standard:backing-property-naming] Backing property is only allowed when a matching property or function exists

Steps to Reproduce

    companion object {
        private var _isEnabled = false
    }

    val isEnabled: Boolean
        get() = _isEnabled

Your Environment

  • Version of ktlint used: 1.4.1
  • Relevant parts of the .editorconfig settings: N/A
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): https://github.com/jeremymailen/kotlinter-gradle 4.5.0
  • Version of Gradle used (if applicable): 8.11.1
  • Operating System and version: macOS 14.7.1
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

No branches or pull requests

1 participant