Summary
The configurationPropertiesPrefixKebabCase rule validates the raw string literal passed to @ConfigurationProperties without resolving Kotlin const val references. Prefixes built with string templates referencing top-level constants are flagged even though the runtime value is valid kebab-case.
Reproducer
const val APP_CONFIG_ROOT = "myapp"
@ConfigurationProperties("\$APP_CONFIG_ROOT.foo")
data class FooProperties(val bar: String)
Running springBootRules { all() }.verify() reports:
CodeGuard:configurationPropertiesPrefixKebabCase: @ConfigurationProperties prefix should use lowercase kebab-case segments:
FooProperties has prefix '\$APP_CONFIG_ROOT.foo'
The effective prefix at runtime is myapp.foo, which is valid kebab-case.
Environment
- spring-boot-code-guard 1.0.7
- Kotlin 2.3
- Konsist 0.17.3
Expected
Either:
- Resolve the
const val reference before validating, or
- Skip validation when the prefix contains an unresolved template expression (avoid false positives), or
- Document the limitation explicitly.
Summary
The
configurationPropertiesPrefixKebabCaserule validates the raw string literal passed to@ConfigurationPropertieswithout resolving Kotlinconst valreferences. Prefixes built with string templates referencing top-level constants are flagged even though the runtime value is valid kebab-case.Reproducer
Running
springBootRules { all() }.verify()reports:The effective prefix at runtime is
myapp.foo, which is valid kebab-case.Environment
Expected
Either:
const valreference before validating, or