Code Formatting Package Outdated - Proposal for Update

Hi Team,

I’ve noticed that the current code formatting package used in the OpenMRS Core repository doesn’t seem to be working as expected. It looks like the package may be outdated and is causing issues with consistent formatting.

To resolve this, I suggest replacing the current formatting package with the formatter-maven-plugin. This plugin is more actively maintained and should provide better support and functionality for automatic code formatting.

My suggestion is to:

  1. Replace the existing formatting package with the formatter-maven-plugin.
  2. Configure the plugin according to our coding standards.
  3. Ensure the plugin is integrated into the build process so that formatting is done automatically.

Let me know your thoughts or if anyone has any concerns about this proposal.

cc - @jayasanka

Yeah, that’s actually a solid suggestion. The current plugin (google-maven-java-formatter-plugin) hasn’t been maintained and the last release was 12 years ago. I tried it too, and like you said, it’s not working. Also, thanks for applying this to the performance testing repo: O3-4554: Configure automatic code formatting by Bawanthathilan · Pull Request #88 · openmrs/openmrs-contrib-performance-test · GitHub

@dkayiwa should we go ahead with this? Seems like a pretty straightforward solution.

What is the minimum version of Java that it requires?

If we’re going to migrate to something, I’d prefer spotless. It supports a wider array of file formats and should be able to just use the existing code format definitions (though we may want to update those as the default code formatting in Eclipse is now a bit different than the very old version we use).

2 Likes

:+1: on using spotless across the board.

FYI, spotless is already part of our module generating archetypes in the sdk as per this commit.

1 Like