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

Use spotless gradle plugin for unified formatting #162

Merged
merged 12 commits into from
Jan 14, 2025
Merged

Conversation

AdamVe
Copy link
Member

@AdamVe AdamVe commented Dec 20, 2024

Adds spotless setup with Google Java Style and reformats existing java sources.

  • To run the formatting manually: ./gradlew spotlessApply
  • adds pre-commit hook to execute format of java files
  • Spotless also has plugins for IDEs. For Android Studio I recommend to install the google-java-format plugin as well.

Todo:

  • verify formatting on commit and fail builds with invalid formatting with ./gradlew spotlessJavaCheck

Note:
Because this PR also reformatted all files, for review please see the following 2 commits:
7ea9ae2
dcee355

Copy link
Member

@emlun emlun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

I also noticed that Spotless can maintain license headers, if that's something we're interested in using. We don't currently use that in java-webauthn-server, but I'd like to at least try it out.

@AdamVe
Copy link
Member Author

AdamVe commented Jan 13, 2025

Looks good to me!

I also noticed that Spotless can maintain license headers, if that's something we're interested in using. We don't currently use that in java-webauthn-server, but I'd like to at least try it out.

Thanks for the review, I verified the target parameters and they are needed for our Android modules.

I am aware of the "license header" functionality but I have not considered it for this PR although I tested it. I am open to synchronize this (including the ratchetFrom option) between our projects 👍🏻

@AdamVe AdamVe merged commit 061076d into main Jan 14, 2025
16 checks passed
@AdamVe AdamVe deleted the adamve/spotless branch January 14, 2025 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants