From 6bb7b09749bc7cd321de6feac16cf96062d2474e Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Fri, 19 Aug 2022 13:00:42 -0700 Subject: [PATCH] misc: Update CONTRIBUTING.md for `pre-commit` This patch does two things: 1. Ensures that both the 'pre-commit' and 'commit-msg' hooks are installed. The `pre-commit install` by itself will only install the 'pre-commit' hooks. This expanded instlal command will also install the 'commit-msg' hook. 2. How to run pre-commit to automatically format your code. Change-Id: I0561f2918568bb9191e4ec457c297fcd264248c0 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/62573 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Reviewed-by: Andreas Sandberg Tested-by: kokoro --- CONTRIBUTING.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0c34efabf2..d81cd9c988 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -147,7 +147,7 @@ To setup pre-commit, run the following in your gem5 directory. ```sh pip install pre-commit -pre-commit install +pre-commit install -t pre-commit -t commit-msg ``` When you run a `git commit` command the pre-commit will run checks on your @@ -158,6 +158,13 @@ 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. +You can automatically format your changed code to pass the pre-commit tests by +running: + +```sh +pre-commit run +``` + Requirements for change descriptions ------------------------------------ To help reviewers and future contributors more easily understand and track