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

Enforce code style format #4087

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

atakavci
Copy link
Contributor

@atakavci atakavci commented Feb 7, 2025

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);

  • improve the style file hbase-formatter.xml as we see the opportunity
  • introduce mandatory validation step into pipeline starting with a small perimeter (only for a single folder with a few files as of this PR)
  • make sure the files covered by mandatory validation are well formatted and cause no errors on pipeline
  • add another workflow(format_check.yml) to the pipeline to follow if the set of files in any PR is well formatted
  • add more directories in iterations with fixing formatting errors and fine tuning style format itself as suggested above

i 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

@atakavci atakavci requested review from tishun and ggivo February 7, 2025 07:47
@atakavci atakavci self-assigned this Feb 7, 2025
Copy link
Contributor

@tishun tishun left a 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
Copy link
Contributor

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 ...

id: changed_files
run: |
echo "::group::Changed Java Files"
CHANGED_FILES=$(git diff --name-only origin/master | grep '\.java$' || true)
Copy link
Contributor

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

@@ -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">
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants