pinterest / ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
https://pinterest.github.io/ktlint/
MIT License
6.24k stars 506 forks source link

Separate constant naming rule from property-naming #2637

Open mxalbert1996 opened 7 months ago

mxalbert1996 commented 7 months ago

Expected Rule behavior

Ktlint reports PascalCase constant names as violations, in compliance with Kotlin/Android style guide. If we want to use PascalCase for constants, we need to disable the rule, but the linting of other non-constant properties is also disabled. It would be great if the naming rule for constants can be separated so that we can disable that rule only.

Since PascalCase is recommended by Baseline style guidelines of Jetpack Compose, I think this is a rather common need.

Additional information

paul-dingemans commented 7 months ago

I am not sure about splitting the rule. An alternative could be to add a configuration parameter to the rule that defines the format to be used for constants. This configuration parameter should then allow values SCREAMING_CASE (default) and PASCAL_CASE.

francisconoriega commented 3 weeks ago

Hi, is this something that is still being considered?

paul-dingemans commented 2 weeks ago

Yes, otherwise I would have closed it. But TBH, it is not high on my list of things to do.