-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Enforce code style format #4087
base: master
Are you sure you want to change the base?
Conversation
This reverts commit ce6314a.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much needed PR I think, thanks for working on that!
@@ -0,0 +1,68 @@ | |||
name: Java Format Check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need an additional action just for that? Could we do it as part of the integration?
If we keep it as a separate action it would do a lot of unnecessary new things - power up a container, fetch the contents of the PR, set Java up ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal here is to confirm that everything developer touches within the PR is well formatted. And, if not, signal this to the developer. If we add this to integration and it fails, the PR won't meet the merge criteria. If we add it and it doesn't fail, then we won't have added a sufficiently noticeable warning.
My intention here is to avoid forcing developer to have everything well formatted with just a single line change in file.
Not to force him, but to give a striking warning.
.github/workflows/format_check.yml
Outdated
id: changed_files | ||
run: | | ||
echo "::group::Changed Java Files" | ||
CHANGED_FILES=$(git diff --name-only origin/master | grep '\.java$' || true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit brittle when we work with branches different than the main branch, we might want to add a parameter to indicate the branch we are merging to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,37 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does having an additional pom.xml help in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check my previous response around having that a more noticeable warning but not forcing it.
This is an initiative to make the code formatting enforced on pipeline.
We will start with small steps and try to cover whole code base in multiple iterations.
The plan is step by step something like this (i guess this makes some sense as is, but lets improve the plan itself as well starting with this PR);
hbase-formatter.xml
as we see the opportunityformat_check.yml
) to the pipeline to follow if the set of files in any PR is well formattedi think this approach will help us to cover more and more directories adding it into pom.xml. Later at some point we ll have full coverage and get rid of directories section in
pom.xml