misc: Update CONTRIBUTING.md to mention pre-commit

Change-Id: I4559274190ce38202ea47b0870f5bd51fcf418ef
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/62055
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
Bobby R. Bruce
2022-08-03 17:42:15 -07:00
committed by Bobby Bruce
parent dbee7bea9f
commit 22dd2065f9

View File

@@ -136,6 +136,28 @@ rebasing and git, see the [git book].
[git book]: https://git-scm.com/book/en/v2/Git-Branching-Rebasing
Setting up pre-commit
---------------------
To help ensure the gem5 style guide is maintained, we use [pre-commit](
https://pre-commit.com) to run checks on changes to be contributed.
To setup pre-commit, run the following in your gem5 directory.
```sh
pip install pre-commit
pre-commit install
```
When you run a `git commit` command the pre-commit will run checks on your
committed code. The commit will be blocked if a check fails.
The same checks are run as part of Gerrit's CI tests (those required to obtain
a Verified label, necessary for a change to be accepted to the develop branch).
Therefore setting up pre-commit in your local gem5 development environment is
recommended.
Requirements for change descriptions
------------------------------------
To help reviewers and future contributors more easily understand and track