Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce the upcoming formatting guidelines by checking them during the CI build #497

Open
tsaglam opened this issue Feb 18, 2022 · 3 comments

Comments

@tsaglam
Copy link
Member

tsaglam commented Feb 18, 2022

If we implement #495, we should also try to enforce these guidelines. A separate CI-workflow should check each PR and fail if the guidelines are not applied correctly. Developers should have an easy means of auto-formatting i.e. a dedicated mvn command to call.

When starting to enforce these guidelines, we require a dedicated commit that formats the whole project once. The timing for that commit needs to be selected carefully, to avoid excessive conflicts with branches and forks.

For this, we could use Spotless. It can use formatter configuration files but also enforce additional rules such as re-ordering pom files. If spotless is part of the maven configuration, the formatting can be applied with mvn spotless:apply.
A CI workflow can be based on the one from JPlag. However, we need to figure out the compatibility with Xtend and the Reaction files.

In the long run, we could also employ Sonarqube.

@tsaglam
Copy link
Member Author

tsaglam commented Feb 18, 2022

For Xtend we cannot easily apply the formatter, but at least it is easy to:

  • enforce indent with space
  • enforce no trailing whitespaces
  • check/enforce via custom regex rules

@tsaglam
Copy link
Member Author

tsaglam commented Feb 18, 2022

Spotless allows to enforce formatting gradually, which would avoid a single monolithic formatting commit:
https://github.com/diffplug/spotless/tree/main/plugin-gradle#how-can-i-enforce-formatting-gradually-aka-ratchet

@TomWerm
Copy link
Member

TomWerm commented Mar 20, 2023

As vitruv-tools/Maven-Build-Parent#36 reverted the Spotless configuration changes, we should discuss whether or not we still plan to implement this PR @vitruv-tools/maintainers .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants