Skip to content

Add an alternative Precommit workflow and make pretty#7328

Open
Growl1234 wants to merge 14 commits intodeepmodeling:developfrom
Growl1234:precommit
Open

Add an alternative Precommit workflow and make pretty#7328
Growl1234 wants to merge 14 commits intodeepmodeling:developfrom
Growl1234:precommit

Conversation

@Growl1234
Copy link
Copy Markdown

@Growl1234 Growl1234 commented May 9, 2026

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:

./make_pretty.sh

which is equivalent to:

./tools/precommit/precommit.py --allow-modifications

This allows contributors to easily check and fix formatting issues before submitting changes.

This PR also applies make_pretty.sh to the current code base, so most of the diff is purely formatting-related. Also, some tabs and using 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.

Copilot AI review requested due to automatic review settings May 9, 2026 17:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@Growl1234

This comment has been minimized.

@Growl1234
Copy link
Copy Markdown
Author

Growl1234 commented May 9, 2026

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.

@Growl1234 Growl1234 force-pushed the precommit branch 4 times, most recently from 94d30de to 02227ef Compare May 9, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants