This updates the pre-commit utility from v4.3.0 to v4.5.0 and updates
black from 22.6.0 to 23.9.1.
Change-Id: I7ebb551f30e617059ce49f89a30207f739b1cb14
This automatically formats .yaml files. By deault has the following
parameters:
* `mapping`: 4 spaces.
* `sequence`: 6 spaces.
* `offset`: 4 spaces.
* `colons`: do not align top-level colons.
* `width`: None.
Change-Id: Iee5194cd57b7b162fd7e33aa6852b64c5578a3d2
Though in ext, we regularly modify these files to add features and
extend our testlib testing infrastructure. Ergo, the pre-commit checks
should be run.
Change-Id: I921a263f25f850b03e5535a8a1f509921c124763
The exclusion in .pre-commit-config.yaml covered all files in
src/python/m5/ext. This excludes src/python/m5/exit/pystats, which we
want covered by black. This commit updates .pre-commit-config.yaml to
only exclude src/python/m5/ext/pyfdt.
This change also runs black on these files.
Change-Id: Iecff45ea2a27a37fc0d00b867d41300aad911c7a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63711
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
The gem5 commit msg checker must be run during the 'commit-msg'
stage ergo this is explicitly set. The other hooks are only applicable
to the "commit" stage, the `default_stage` for the hooks.
To install all the hooks, you need to run the following:
```
pre-commit install -t pre-commit -t commit-msg
```
This ensures both the 'commit-msg' and 'pre-commit' hooks are installed.
If you run just `pre-commit install`, only the pre-commit hooks are
installed.
Change-Id: I4a0dcc7159ed5048baa120adf80bbf65f63c11dd
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/62552
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Add a pre-precommit configuration that can be used to run a series of
automated tests in CI. This configuration currently enforces Black
style on Python files and checks for other common errors (incorrect
json, mixed line endings etc.).
The CI system runs pre-commit using the following command:
pre-commit run --from-ref HEAD~ --to-ref HEAD
Users can install pre-commit hooks in their git repositories using the
following command:
pre-commit install
Note that our scons scripts automatically install a simple style
checker as a pre-commit hooks already. If the pre-commit tool is
installed after the existing hook, the existing hook will be kept and
called automatically.
The current pre-commit configuration doesn't currently doesn't run the
C++ style checker automatically. This feature could easily be added in
the future by adding the following to the pre-commit file:
- repo: local
hooks:
- id: style-checker
name: Check C++ coding style
language: python
entry: util/style.py -f
The main reason this isn't already in the configuration is that it is
expected that the style checker will have some false positives since
style checks will be enforced on the entire file rather than the lines
changed in a commit.
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Change-Id: Ibbb1dc641e2979509f3259cd951c7272094d69f5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/61111
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>