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

Adds Spotless code formatter #288

Merged
merged 7 commits into from
Jul 20, 2023
Merged

Adds Spotless code formatter #288

merged 7 commits into from
Jul 20, 2023

Conversation

MitchellGale
Copy link

@MitchellGale MitchellGale commented Jul 11, 2023

Description

Adds support for Spotless code formatter via ./gradlew spotlessApply and ./gradlew spotlessCheck. Apply applies the checks, check notifies which changes need to be applied.

Checks applied:

Issues Resolved

opensearch-project#1101

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@codecov
Copy link

codecov bot commented Jul 11, 2023

Codecov Report

Merging #288 (36e7f3b) into integ/spotless (f92e48c) will not change coverage.
The diff coverage is n/a.

❗ Current head 36e7f3b differs from pull request most recent head 18a75bd. Consider uploading reports for the commit 18a75bd to get more accurate results

@@                Coverage Diff                @@
##             integ/spotless     #288   +/-   ##
=================================================
  Coverage             97.39%   97.39%           
  Complexity             4608     4608           
=================================================
  Files                   401      401           
  Lines                 11408    11408           
  Branches                843      843           
=================================================
  Hits                  11111    11111           
  Misses                  290      290           
  Partials                  7        7           
Flag Coverage Δ
sql-engine 97.39% <ø> (ø)

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

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@MitchellGale MitchellGale mentioned this pull request Jul 11, 2023
6 tasks
Copy link

@MaxKsyunz MaxKsyunz left a comment

Choose a reason for hiding this comment

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

Have you seen this PR?
Can you use the googleJavaFormat line from there and import wildcards check?

And similarly to https://github.com/opensearch-project/OpenSearch/blob/main/gradle/formatting.gradle, can you try applying spotless to md and rst files as well?

RST files may be a headache (could break doctest) so if it does not work well, we can do it separately.

Copy link

@Yury-Fridlyand Yury-Fridlyand left a comment

Choose a reason for hiding this comment

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

Please, rebase to fix CI

DEVELOPER_GUIDE.rst Outdated Show resolved Hide resolved
@MitchellGale
Copy link
Author

Have you seen this PR? Can you use the googleJavaFormat line from there and import wildcards check?

And similarly to https://github.com/opensearch-project/OpenSearch/blob/main/gradle/formatting.gradle, can you try applying spotless to md and rst files as well?

RST files may be a headache (could break doctest) so if it does not work well, we can do it separately.

Why should we use 1.15.0?

@MitchellGale MitchellGale force-pushed the dev/spotless branch 3 times, most recently from 9f63b92 to 120b5a4 Compare July 12, 2023 03:33
@Yury-Fridlyand
Copy link

FAILURE: Build failed with an exception.

* Where:
Build file '/home/runner/work/opensearch-project-sql/opensearch-project-sql/build.gradle' line: 83

* What went wrong:
A problem occurred evaluating root project 'opensearch-sql'.
> Could not find method spotless() for arguments [build_8w75flnn8q[43](https://github.com/Bit-Quill/opensearch-project-sql/actions/runs/5527388334/jobs/10083082365?pr=288#step:4:44)fb46rqwsp8d78$_run_closure2@57f6c75d] on root project 'opensearch-sql' of type org.gradle.api.Project.

@Yury-Fridlyand
Copy link

Yury-Fridlyand commented Jul 12, 2023

Can spotless verify/add license headers? If yes, please add this to configuration.
And the same with line endings (\n instead of \r\n).

@MaxKsyunz
Copy link

Why should we use 1.15.0?

It was the latest release at the time.

The key is to specify the version of rules being used. This avoids new versions of formatting rules forcing unrelated changes to a PR.

@MitchellGale
Copy link
Author

Why should we use 1.15.0?

It was the latest release at the time.

The key is to specify the version of rules being used. This avoids new versions of formatting rules forcing unrelated changes to a PR.

Ah! That makes sense, thanks. Will specify version :)

@MitchellGale MitchellGale force-pushed the dev/spotless branch 3 times, most recently from 76bbcf1 to 6874b74 Compare July 20, 2023 05:30
Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>

Remove commented out spotless changes.

Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>

Adding Spotless to DEVELOPER_GUIDE.rst

Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>

Added Google Java format to spotless.

Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>

Update DEVELOPER_GUIDE.rst

Co-authored-by: Yury-Fridlyand <yury.fridlyand@improving.com>
MitchellGale and others added 6 commits July 19, 2023 23:32
Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>
Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>
Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>
Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>
Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>
Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>
@MitchellGale MitchellGale merged commit e645a51 into integ/spotless Jul 20, 2023
14 of 18 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