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

mvn format command doesn't format all files #387

Open
Miles-Garnsey opened this issue Sep 20, 2023 · 2 comments
Open

mvn format command doesn't format all files #387

Miles-Garnsey opened this issue Sep 20, 2023 · 2 comments
Assignees

Comments

@Miles-Garnsey
Copy link
Member

When we run mvn com.coveo:fmt-maven-plugin:format as recommended by a failing build output, it does not format all files and CI will continue to fail.

Instead, one must also run mvn xml-format:xml-format -P dse,dse7,trunk in order to get CI to run.

This is confusing for new developers and (even for those of us who know about it) is an easy step to miss. A single command should run both steps. Also, both steps should be run in a pre-commit hook by git, so that developers aren't forced to frequently amend their commits before re-pushing.

@emerkle826
Copy link
Contributor

The dse, dse7, and trunk Maven profiles aren't enabled by default so you have to enable them on the command line (or with IDE tooling) if you want maven targets to run on them. The DSE profiles in particular require access to DSE artifacts, and not everyone will have the required access. That's why those profiles aren't enabled by default. The trunk profile is for Cassandra trunk builds, which by nature may be unstable.

As for formatting, it is documented in the [README}(https://github.com/k8ssandra/management-api-for-apache-cassandra#checking-the-format). You can simply run

mvn fmt:check -P dse,dse7,trunk

Before committing your changes. Also, the format is checked during the compile phase. If any files are not in compliance, the compile will fail and tell you which files are not in compliance.

I can add a pre-commit hook if that makes things better.

@Miles-Garnsey
Copy link
Member Author

I guess the reason we're having this problem in this repo specifically is that some contributors aren't on Linux and therefore aren't running tests/compilation locally, so the formatting checks can get missed. Erik and I have agreed that in this specific case a pre-commit hook which does the formatting locally before anything is ever committed is probably going to speed things up a little.

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

No branches or pull requests

2 participants