Sha Sha Chu
09/27/2022, 7:34 PMmy-custom-ruleset:my-custom-rule
. now it seems we explicitly put the ruleset name in the Rule
(e.g. https://github.com/pinterest/ktlint/blame/master/ktlint-ruleset-experimental/src/m[…]t/ktlint/ruleset/experimental/DiscouragedCommentLocationRule.kt) which seems to make any given Rule
class less portable. can you describe why we made that change?Paul Dingemans
09/28/2022, 7:11 PM.editorconfig
property ktlint_disable_rules
but also all references in ktlint suppression statements have to be changed as well. In case a rule is referenced in a VisitorModifier
then also this reference has to change.
Some API consumers, define custom ruleset providers but re-use a selection of ktlint rules. Although it is fine that API consumers do so, this should never affect the VisitorModifier
rules which were defined for that rule inside ktlint.
Another reason is related to Unit testing. The majority of the tests only run one specific rule. A minority of the tests however require to run a collection of rules. In those cases it is necessary to run the rules in the exact same order as they would have be run by the CLI/API version. When running the unit tests, the ruleset providers are not used (see https://github.com/pinterest/ktlint/commit/5eef6a7843eca7897d50e86440e3bab34bdb19a5).
In one of upcoming releases, I intend to remove the notion of the experimental
ruleset in ktlint entirely. Instead, a new rule will be incorporated directly into the standard
ruleset but it will be marked with a tag
holding value experimental
. The current logic which add/removes the experimental rules set will be replaced with filtering based on the tag
.Sha Sha Chu
09/29/2022, 4:45 PM// ktlint-disable
imperatives stopped working for our custom rulesetsPaul Dingemans
09/30/2022, 12:12 PM