I have a file which uses non-standard enum capital...
# ktlint
j
I have a file which uses non-standard enum capitalization (because it's code translated from another project). I put
Copy code
@file:Suppress("ktlint:standard:enum-entry-name-case")
at the top of the file. This works with my command-line ktlint (which is 0.49.1) but in ktlint-maven-plugin 1.16.0 (which uses ktlint 0.48.2) I still get the error
Copy code
Enum entry name should be uppercase underscore-separated names like "ENUM_ENTRY" or upper camel-case like "EnumEntry"
Is there a different syntax which will suppress the rule properly in both versions?
Answering my own question -- 0.49 added the
:standard:
component to the rule names; older versions didn't have that. 0.49 still recognizes rule names without
:standard:
for backward compatibility. Thus, changing it to
Copy code
@file:Suppress("ktlint:enum-entry-name-case")
works for both ktlint versions.
p
Yeah, there is no harm in doing that. In ktlint
1.0.0
the
:standard:
becomes mandatory, but it will be changed automatically when reformatting the code.