pinterest / ktlint

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

Separate constant naming rule from property-naming #2637

Open mxalbert1996 opened 2 months ago

mxalbert1996 commented 2 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 2 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.