Add an alternative Precommit workflow and make pretty#7328
Open
Growl1234 wants to merge 14 commits intodeepmodeling:developfrom
Open
Add an alternative Precommit workflow and make pretty#7328Growl1234 wants to merge 14 commits intodeepmodeling:developfrom
Growl1234 wants to merge 14 commits intodeepmodeling:developfrom
Conversation
This comment has been minimized.
This comment has been minimized.
Author
|
It also seems some input files are not that pretty now due to my automatic fixes regarding tab characters. Maybe it's worth adding a check regarding ABACUS input files in the future. |
94d30de to
02227ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a self-contained precommit driver for ABACUS, replacing the previous workflow that relied on GitHub Action built-in/pre-commit style drivers.
The new implementation is inspired by the precommit infrastructure used in CP2K. It provides a project-owned driver under
tools/precommit/precommit.py, together with a local precommit server for running external formatting/checking tools in a controlled environment (it would be best if a remote server is configured).The driver performs strict formatting and file-property checks for files tracked by Git, covering most file types used in the repository. By default, it runs in check-only mode and reports formatting differences without modifying files. When invoked with
--allow-modifications, it can automatically fix part of the formatting issues, such as indentation and style inconsistencies.A convenience script has also been added at the repository root:
which is equivalent to:
This allows contributors to easily check and fix formatting issues before submitting changes.
This PR also applies
make_pretty.shto the current code base, so most of the diff is purely formatting-related. Also, some tabs andusing namespace std;appeared in header codes are fixed based on precommit report.The new precommit infrastructure is already usable for regular development and CI checks in my view. Some project-specific rules may still require further refinement as more cases are found in practice. I will continue to follow up and adjust the workflow if additional issues are reported.