Fail the build on wrong import order

Hi devs,

We have some rules about the right import order:

We also have IJ IDEA + Eclipse settings to follow that order:

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.

WDYT?

Thanks

I assume you meant https://dev.xwiki.org/xwiki/bin/view/Community/CodeStyle/JavaCodeStyle/#HImports.

+1 to add a check for import order in the checkstyle configuration

yes thx, corrected.