-
Notifications
You must be signed in to change notification settings - Fork 5
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
standardize CMake linting and auto-formatting across RAPIDS #62
Comments
I can provide some context that will hopefully answer some of your questions. rapidsai/cudf#9484 was the original source for pre-commit-based CMake linting in RAPIDS. The comment at the top of the run-cmake-format.sh script has remained largely unchanged since then and explains why this approach is necessary and we cannot use the existing hooks directly. To answer
These hooks did exist then. The problem is fundamentally that since we use a lot of rapids-cmake functions everywhere, if we do not have the format file from rapids-cmake available we will incorrectly reformat all of our CMake in local runs of the pre-commit hook. To prevent this, the wrapper script is designed to exit out (without failing!) if that file is not available. The assumption is that the number of people who actually modify the CMake is limited and those people will know that they need this file available locally in order to match remote formatting. The script makes some best effort attempts at finding the file based on the repository root and the build directory where the file will be cloned into. In the time since then we have also started including additional configuration, as you have noted. So to answer
The two main things that this hook should do beyond the hooks that are already available is:
|
Description
As of this writing, CMake formatting varies somewhat across RAPIDS. It would be great to standardize the look and feel of CMake code across RAPIDS, and
pre-commit
seems like a good system to do that.This could involve creating new hooks or choosing from the existing third-party open-source projects.
Benefits of this work
Acceptance Criteria
pre-commit
hook(s) for CMake autoformatting and lintingApproach
1. Review the current approaches used across RAPIDS
Several RAPIDS projects use the following approach:
cmake-format
andcmake-lint
inpre-commit
-friendly ways (example: cudf/cpp/scripts/ run-cmake-format.sh)cmake-format
(example: cudf/cpp/cmake/config.json)rapids-cmake
repo like this:(example: cudf/ci/check_style.sh)
(example: cudf/.pre-commit-config.yaml)
2. Review open-source options
Both
cmake-format
andcmake-lint
have official pre-commit hooks.These might not have existed or might not have fits RAPIDS needs when the approach described above was first introduced.
3. Pick a path and implement it
Some functionality I think we want:
npm
/ Node,go
)Notes
Historical context:
The text was updated successfully, but these errors were encountered: