FYI, I was confused for a few minutes about why I ...
# ktlint
g
FYI, I was confused for a few minutes about why I needed to enable the
EXPERIMENTAL_RULES_EXECUTION_PROPERTY
to get the
StatementWrappingRule
to run. While that rule is listed as experimental on the documentation page, it comes out of the standard KtLint rules import and has its rule name prefixed with "standard:". So that threw me off a bit. I guess I can understand shipping fairly stable experimental rules in the standard artifact, but is there a reason it's name isn't prefixed with experimental?
s
that feels like a bug. would you mind filing an issue?
p
Yes there is a good reason not to prefix it. Moving a rule between ruleset also means that all users need to update the .editorconfig files and rule suppressions in the source code.
👍 1
g
Yeah, that makes sense. It's just a bit confusing to have a standard-prefixed rule coming out of the standard KtLint ruleset package that requires an experimental flag be set. I also assume you'll have the same transition problem with other rules, correct? Unless everything that eventually lands in the standard ruleset starts with the standard prefix. (I'd like that type of foreknowledge...)
Is the experimental ruleset package no longer supported? (It's version is a bit behind the main packages.) Having experimental rules live there would at least provide one additional hint to API users.
p
Experimental rules all live in standard ruleset nowadays. There is no longer a separate ruleset. Please read changelogs of the versions that you skipped for more information.
g
Thanks. What's the right programmatic way to determine whether a given ruleset contains experimental rules?
p
Euh, looking into the code or docs I guess. I am not aware whether other ruleset providers already make use of the possibility to offer experimental rules.
g
Hmmm... But I assume that internally KtLint has to know this, correct? Because it knew to not apply that rule until I enabled the experimental flag...
p
Yes, in ktlint all experimental rules implement interface Rule.Experimental
👍 1
g
OK, great! That's helpful.