In Quarkus for example, the build is set up to:
- check formatting and imports very strictly on compilation
- auto-format code and auto-sort imports on request (on process-sources)
This has benefits (very consistent style) and drawbacks (annoying build failures just because of formatting), but since we already enforce a (rather loose) style, I thing we could benefit from the same approach. Introducing tooling wouldn’t be a problem, we just have to copy what’s been done on Quarkus, replacing the Quarkus style with our own. We will have to adapt the contribution guide as well. The real problem will be dealing with Git history, since I expect a big commit that will reformat almost every file in the code base. Maybe we should introduce a file listing all commits to ignore in git-blame, as explained here. It would require setup on each clone (git config), but some setup is already required to use the proper style in Intellij, so it’s no big deal. Plus, it seems compatible with the git blame feature inside Intellij IDEA. NOTE: We’d better do this in a version of Hibernate Search that will not require much backports, because the “big formatting commit” will make backporting rather annoying (many conflicts). |