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 Code Format with Checkstyle and/or Spotless and/or Google Java Format #129

Open
vorburger opened this issue May 14, 2023 · 1 comment

Comments

@vorburger
Copy link
Owner

Given that this project is starting to get PR contributions, it would IMHO be good to enforce a good format.

I'm already working on a PR with Checkstyle - which I'm hoping is quick - because I'll just copy/paste this and the respective lines from the MariaDB4j pom.xml .

This ch.vorburger.exec code historically actually originates from MariaDB4j and used to be formatted like that, so I expect that it should need relatively few changes only.

In #126 @mosesn has raised possibly using https://github.com/diffplug/spotless as a possible alternative. I am personally less motivated for doing the work for that, just because it would take me longer to figure out how to set up. (But years ago I actually was a Google Summer of Code GSoC mentor advising a student to add Spotless to https://github.com/apache/fineract/ and it seemed great, so I have no strong objections to replace Checkstlye with Spotless - if someone else wants to put in the work for it!) I don't suppose Spotless can use a Checkstyle configuration, can it?

An alternative could be using https://github.com/google/google-java-format. I have adopted that in my latest project, for https://github.com/enola-dev/enola, see https://docs.enola.dev, and quite like it too. I haven't looked much into the available Maven plugins, although looking at https://github.com/google/google-java-format#third-party-integrations it seems like Spotless may actually use Google Java Format internally? I'm OK if someone wants to raise a PR for that.

BTW on this sort of things, for Enola.dev I've also had loads of fun with a .pre-commit-config.yaml, and loads of related configuration files like .editorconfig and .prettierrc.yaml and .clang-format and .markdownlint.yaml and .protolint.yaml, but I think for this ch.vorburger.exec project I want to keep the "barrier to entry" lower by sticking to a pure Java and fully Maven integrated approach, only.

Thoughts - anyone?

@vorburger
Copy link
Owner Author

#132 adds Checkstyle - just because that was the fastest for me to do, and prevents discrepancies.

I'm fairly open to PRs which would propose to remove Checkstyle to replace it with something else.

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

1 participant