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

Bump Checkstyle version to latest #767

Merged
merged 2 commits into from
Aug 17, 2022

Conversation

dai-chen
Copy link
Collaborator

@dai-chen dai-chen commented Aug 16, 2022

Signed-off-by: Chen Dai daichen@amazon.com

Description

  1. Bump checkstyle from 8.28 to the latest version and fixed all violations.
  2. Change subprojects to allprojects to enforce root project using same version as subproject (specified by toolVersion). Otherwise, the default Checkstyle version (8.37) defined by Gradle is in use.
$ ./gradlew dependencies :sql:dependencies :ppl:dependencies :core:dependencies :protocol:dependencies :opensearch-sql-plugin:dependencies :opensearch:dependencies :legacy:dependencies :common:dependencies | grep checkstyle
checkstyle - The Checkstyle libraries to be used for this project.
\--- com.puppycrawl.tools:checkstyle:10.3.2
checkstyle - The Checkstyle libraries to be used for this project.
\--- com.puppycrawl.tools:checkstyle:10.3.2
checkstyle - The Checkstyle libraries to be used for this project.
\--- com.puppycrawl.tools:checkstyle:10.3.2
checkstyle - The Checkstyle libraries to be used for this project.
\--- com.puppycrawl.tools:checkstyle:10.3.2
checkstyle - The Checkstyle libraries to be used for this project.
\--- com.puppycrawl.tools:checkstyle:10.3.2
checkstyle - The Checkstyle libraries to be used for this project.
\--- com.puppycrawl.tools:checkstyle:10.3.2
checkstyle - The Checkstyle libraries to be used for this project.
\--- com.puppycrawl.tools:checkstyle:10.3.2
checkstyle - The Checkstyle libraries to be used for this project.
\--- com.puppycrawl.tools:checkstyle:10.3.2
checkstyle - The Checkstyle libraries to be used for this project.
\--- com.puppycrawl.tools:checkstyle:10.3.2

$ ./gradlew dependencies :sql:dependencies :ppl:dependencies :core:dependencies :protocol:dependencies :opensearch-sql-plugin:dependencies :opensearch:dependencies :legacy:dependencies :common:dependencies | grep guava | grep 28

Issues Resolved

#431

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.

Signed-off-by: Chen Dai <daichen@amazon.com>
@dai-chen dai-chen added the dependencies Pull requests that update a dependency file label Aug 16, 2022
@dai-chen dai-chen self-assigned this Aug 16, 2022
@codecov-commenter
Copy link

codecov-commenter commented Aug 17, 2022

Codecov Report

Merging #767 (f365a9d) into main (23a4a88) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main     #767   +/-   ##
=========================================
  Coverage     94.85%   94.85%           
  Complexity     2910     2910           
=========================================
  Files           287      287           
  Lines          7831     7831           
  Branches        571      571           
=========================================
  Hits           7428     7428           
  Misses          349      349           
  Partials         54       54           
Flag Coverage Δ
query-workbench 62.76% <ø> (ø)
sql-engine 97.79% <ø> (ø)

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

Impacted Files Coverage Δ
...ensearch/storage/script/core/ExpressionScript.java 100.00% <ø> (ø)
...pensearch/sql/protocol/response/format/Format.java 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Signed-off-by: Chen Dai <daichen@amazon.com>
@Yury-Fridlyand
Copy link
Collaborator

Are you planning to activate checkstyle for :protocol, :integ-test and :plugin?

@dai-chen dai-chen marked this pull request as ready for review August 17, 2022 16:01
@dai-chen dai-chen requested a review from a team as a code owner August 17, 2022 16:01
@dai-chen
Copy link
Collaborator Author

Are you planning to activate checkstyle for :protocol, :integ-test and :plugin?

I think Checkstyle has been activated for all our modules?

@Yury-Fridlyand
Copy link
Collaborator

Maybe it is activated, but

./gradlew :integ-test:checkstyleTest
...
Checkstyle files with violations: 55
Checkstyle violations by severity: [error:959]
...
BUILD SUCCESSFUL in 1m 11s

All 959 errors are ignored/suppressed.

@dai-chen
Copy link
Collaborator Author

checkstyleTest.ignoreFailures = true in integ-test because of many IT code is from legacy engine. Are you suggesting to enable it? Sorry, I didn't get your concern in your previous comment.

@Yury-Fridlyand
Copy link
Collaborator

Oh, I see. Just curious whether we need this in integration tests.

@dai-chen
Copy link
Collaborator Author

dai-chen commented Aug 17, 2022

Oh, I see. Just curious whether we need this in integration tests.

Got it. I guess it has been disabled because there were too many IT code from legacy engine when we migrated. Probably we should have only disabled it for org.opensearch.sql.legacy folder by adding it to suppressions.xml. Not sure if it's too late to do that now? :)

@Yury-Fridlyand
Copy link
Collaborator

./gradlew :legacy:checkstyleMain :legacy:checkstyleTest has no errors, these checks are enforced in build - that is confusing. Test code doesn't go to production, but all checkstyleTest (except integration) are enforced.
We can consider fixing this in scope of another task if it is needed and then activate it for :integ-test.

@dai-chen
Copy link
Collaborator Author

./gradlew :legacy:checkstyleMain :legacy:checkstyleTest has no errors, these checks are enforced in build - that is confusing. Test code doesn't go to production, but all checkstyleTest (except integration) are enforced. We can consider fixing this in scope of another task if it is needed and then activate it for :integ-test.

I guess the reason you didn't see error is the entire legacy module is excluded in suppressions.xml: https://github.com/opensearch-project/sql/blob/main/config/checkstyle/suppressions.xml#L8

@dai-chen dai-chen merged commit 8103d9f into opensearch-project:main Aug 17, 2022
@dai-chen dai-chen deleted the bump-checkstyle-version branch August 17, 2022 23:14
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 17, 2022
* Bump checkstyle version and fix violations

Signed-off-by: Chen Dai <daichen@amazon.com>

* Fix checkstyle violations in test code

Signed-off-by: Chen Dai <daichen@amazon.com>

Signed-off-by: Chen Dai <daichen@amazon.com>
(cherry picked from commit 8103d9f)
dai-chen added a commit that referenced this pull request Aug 17, 2022
* Bump checkstyle version and fix violations

Signed-off-by: Chen Dai <daichen@amazon.com>

* Fix checkstyle violations in test code

Signed-off-by: Chen Dai <daichen@amazon.com>

Signed-off-by: Chen Dai <daichen@amazon.com>
(cherry picked from commit 8103d9f)

Co-authored-by: Chen Dai <daichen@amazon.com>
@opensearch-trigger-bot
Copy link
Contributor

The backport to 1.3 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.3 1.3
# Navigate to the new working tree
cd .worktrees/backport-1.3
# Create a new branch
git switch --create backport/backport-767-to-1.3
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 8103d9f4f93305f741ba22b7b87dafc4920280f2
# Push it to GitHub
git push --set-upstream origin backport/backport-767-to-1.3
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.3

Then, create a pull request where the base branch is 1.3 and the compare/head branch is backport/backport-767-to-1.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.3 backport 2.x dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants