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

build: change checkstyle to google code format, plus adding spotless #1264

Conversation

aepfli
Copy link
Member

@aepfli aepfli commented Jan 2, 2025

We regularly fight with code styles in pull requests, which is annoying to both the contributors and the maintainers.

There are tools out there, like Spotless, that can automate those processes. We could define our code style, but there is already one widely used code style from Google (Google Java format).

Existing plugins help us follow this code style within IntelliJ and Visual Studio Code. Switching to this definition can improve the overall experience.

This supersedes the pull request with .editorconfig

notes

  • first commit contains the changes to the tooling
  • second commit contains the applied formatting changes

Disclaimer

This pull request should be used to discuss this; most people do not have significant opinions regarding code styles as long as there are tools to enforce them. Now we have a maven target, spotless:apply, which will inform you about violations and fix them.

relates to: https://github.com/open-feature/java-sdk-contrib/pull/1121/checks

@aepfli aepfli requested a review from a team as a code owner January 2, 2025 08:51
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
@aepfli aepfli force-pushed the build/add_spotless_for_autoformatting branch from a2ce53a to 35aad9b Compare January 2, 2025 08:54
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 98.70968% with 2 lines in your changes missing coverage. Please review.

Project coverage is 93.69%. Comparing base (f1817d8) to head (09a46b9).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...in/java/dev/openfeature/sdk/EvaluationContext.java 50.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1264      +/-   ##
============================================
+ Coverage     93.47%   93.69%   +0.21%     
  Complexity      464      464              
============================================
  Files            43       43              
  Lines          1088     1110      +22     
  Branches         86       89       +3     
============================================
+ Hits           1017     1040      +23     
+ Misses           44       43       -1     
  Partials         27       27              
Flag Coverage Δ
unittests 93.69% <98.70%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aepfli aepfli force-pushed the build/add_spotless_for_autoformatting branch 3 times, most recently from 96b02b3 to e01f15b Compare January 2, 2025 10:13
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
@aepfli
Copy link
Member Author

aepfli commented Jan 2, 2025

... added contributing.md section

Copy link
Member

@toddbaert toddbaert left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@guidobrei guidobrei left a comment

Choose a reason for hiding this comment

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

Thank you for adding this.
Not sure if it should be part of this PR, but do we plan to check/autocorrect in pre-commit hooks and our CI pipeline?

@aepfli
Copy link
Member Author

aepfli commented Jan 3, 2025

Thank you for adding this. Not sure if it should be part of this PR, but do we plan to check/autocorrect in pre-commit hooks and our CI pipeline?

actually this should be automatically part of maven verify - based on the docs By default, spotless:check is bound to verify maven phase. This means it is not required to explicitly bind the plugin execution, and the following will suffice; but within my demo pr #1265 - i do not see an execution

... but it seems like i accidentally bound it to the wrong profile, i will fix this

Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
@aepfli
Copy link
Member Author

aepfli commented Jan 3, 2025

added spotless:verify to the check goal now correctly, misread the docs here. thank you for pointing me into the right direction @guidobrei

Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
@aepfli aepfli merged commit 64ec68b into open-feature:main Jan 3, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants