The proposal here (asked originally by @MichaelHamann) is to break the build (using the existing checkstyle rule) if that order is not satisfied. The idea is to do a mechanistic full sweep of all violations and fix them in a few commits before enabling the check in the build.
The rationale is to avoid diffs in the order (for ex, if the order is not followed and your idea re-order automatically, you’ll get a diff). And avoid later corrections for both code contributions from some non-committers and for code written by coding agents.
groups: imports matching none of them land in an implicit trailing group, which is exactly the “any other imports” bucket of our rule.
separated=true: enforces the blank line between groups, and also rejects a blank line in the middle of a group.
option=bottom: static imports go last. Note that it also requires the blank line between the last non-static group and the static block.
sortStaticImportsAlphabetically=true: without it, the ordering inside the static block isn’t checked at all.
caseSensitive is left to its default (true), which is what matches our IDEA config: setting it to false gives 743 violations in commons alone, versus 37 with true.
One point to decide: checkstyle.xml is only applied to main sources, test sources go through checkstyle-test.xml. I’d add the same module to both, since a good half of the violations I found are in test code (and the whole point is to avoid IDE-generated diffs, which happens as much in tests).
WDYT? Ok for you to start introducing a checkstyle config for tests, starting with this import order?