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

Add checkstyle in maven build #2610

Open
wants to merge 21 commits into
base: branch-24.12
Choose a base branch
from

Conversation

liurenjie1024
Copy link
Collaborator

Close #2591.

The style check only checks modified files in each pr.

@liurenjie1024
Copy link
Collaborator Author

build

Copy link
Member

@jlowe jlowe left a comment

Choose a reason for hiding this comment

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

This PR needs to run checkstyle on the entire eligible codebase and update files accordingly to match the desired style. Otherwise we're going to have a parade of PRs where the change they want to make is relatively small, but the change is dwarfed by the style fixes required to pass CI. This would also help sanity check that the configured style checks are doing what we desire in this PR.

.github/workflows/checkstyle.yml Outdated Show resolved Hide resolved
set -ex

# Assuming you are in the root of your git repository
MODIFIED_FILES=$(git diff --name-only "origin/${GITHUB_BASE_REF}")
Copy link
Collaborator

@pxLi pxLi Nov 21, 2024

Choose a reason for hiding this comment

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

agree with Jason, We would like to not only check style for incremental changes.

and this script is current for github action only with the ENV provided by github.
can we just check against all eligible code with the merged commit for PR? and developers could also run the script to check their change locally before filing a PR

and in that case we do not need below in action def then

      with:
        submodules: true
        fetch-depth: 0

    - name: Fetch branches and tags
      run: git fetch --all

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See comments below.

@liurenjie1024
Copy link
Collaborator Author

This PR needs to run checkstyle on the entire eligible codebase and update files accordingly to match the desired style. Otherwise we're going to have a parade of PRs where the change they want to make is relatively small, but the change is dwarfed by the style fixes required to pass CI. This would also help sanity check that the configured style checks are doing what we desire in this PR.

I ran the checkstyle which detected 744 errors, and most of them not easy to fix since it's not simple formatting issue, for example, missing docs, naming abbreviations, etc. The effort to fix them all is quite huge.

@jlowe
Copy link
Member

jlowe commented Nov 21, 2024

I ran the checkstyle which detected 744 errors, and most of them not easy to fix since it's not simple formatting issue, for example, missing docs, naming abbreviations, etc. The effort to fix them all is quite huge.

Then this PR should not go in like this. It adds a significant burden to all future PRs, because if some PR needs to touch many files, now the burden you didn't want to perform is forced on an unrelated PR. Like I said, we do not want any required fixes to be performed "on the fly" via unrelated PRs. It's mixing purposes and makes those PRs harder to write and harder to read.

Can we turn on only some of the checkstyle rules for this first version and update any errant files accordingly? We can then turn on more and more checks via foilowup PRs to make the changes manageable.

@pxLi
Copy link
Collaborator

pxLi commented Nov 21, 2024

This PR needs to run checkstyle on the entire eligible codebase and update files accordingly to match the desired style. Otherwise we're going to have a parade of PRs where the change they want to make is relatively small, but the change is dwarfed by the style fixes required to pass CI. This would also help sanity check that the configured style checks are doing what we desire in this PR.

I ran the checkstyle which detected 744 errors, and most of them not easy to fix since it's not simple formatting issue, for example, missing docs, naming abbreviations, etc. The effort to fix them all is quite huge.

Can we try disabling some rules (e.g., docs) initially and fixing those critical ones only within this change?

@liurenjie1024
Copy link
Collaborator Author

I have auto fixed formats, and disabled not import rules, PTAL cc @jlowe @pxLi

@liurenjie1024
Copy link
Collaborator Author

build

@liurenjie1024
Copy link
Collaborator Author

build

@liurenjie1024
Copy link
Collaborator Author

build

Comment on lines +29 to +37
* SQL is:
* select
* case
* when bool_1_expr then "value_1"
* when bool_2_expr then "value_2"
* when bool_3_expr then "value_3"
* else "value_else"
* end
* from tab
Copy link
Member

Choose a reason for hiding this comment

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

The original way the comment was written was easier to read. IMO style checks should not be messing with leading whitespace within a comment, as it's likely intentional. This comment applies to other places where leading whitespace of indented blocks was removed.

* Since the result column may or may not be used regardless of the value of hasFailure, we
* need to keep it and let the caller to decide.
*/
public static class CastFloatToDecimalResult {
Copy link
Member

Choose a reason for hiding this comment

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

This is a huge PR, and a large reason for that is the enforcement of a strict declaration order of inner classes and methods. I think that should be deferred to a followup since I'm not sure everyone on the team would agree the new order is better.

Once that is removed, this PR should be relatively small once whitespace diffs are ignored.

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.

[FEA] Add checkstyle for building.
3 participants