misc,python: Add pre-commit-hook-yamlfmt to pre-commit

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
This commit is contained in:
Bobby R. Bruce
2023-10-09 13:16:52 -07:00
parent bbe05b0cba
commit 5b09777011

View File

@@ -1,3 +1,4 @@
---
# Copyright (c) 2022 Arm Limited # Copyright (c) 2022 Arm Limited
# All rights reserved. # All rights reserved.
# #
@@ -33,57 +34,61 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
minimum_pre_commit_version: "2.18" minimum_pre_commit_version: '2.18'
default_language_version: default_language_version:
python: python3 python: python3
exclude: | exclude: |
(?x)^( (?x)^(
ext/(?!testlib/).*| ext/(?!testlib/).*|
build/.*| build/.*|
src/systemc/ext/.*| src/systemc/ext/.*|
src/systemc/tests/.*/.*| src/systemc/tests/.*/.*|
src/python/m5/ext/pyfdt/.*| src/python/m5/ext/pyfdt/.*|
tests/.*/ref/.* tests/.*/ref/.*
)$ )$
default_stages: [commit] default_stages: [commit]
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0 rev: v4.3.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
- id: end-of-file-fixer - id: end-of-file-fixer
- id: check-json - id: check-json
- id: check-yaml - id: check-yaml
- id: check-added-large-files - id: check-added-large-files
- id: mixed-line-ending - id: mixed-line-ending
args: [--fix=lf] args: [--fix=lf]
- id: check-case-conflict - id: check-case-conflict
- repo: https://github.com/psf/black - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 22.6.0 rev: 0.2.3
hooks: hooks:
- id: black - id: yamlfmt
- repo: local - repo: https://github.com/psf/black
hooks: rev: 22.6.0
- id: gem5-style-checker hooks:
name: gem5 style checker - id: black
entry: util/git-pre-commit.py - repo: local
always_run: true hooks:
exclude: ".*" - id: gem5-style-checker
language: system name: gem5 style checker
description: 'The gem5 style checker hook.' entry: util/git-pre-commit.py
- id: gem5-commit-msg-checker always_run: true
name: gem5 commit msg checker exclude: .*
entry: ext/git-commit-msg language: system
language: system description: The gem5 style checker hook.
stages: [commit-msg] - id: gem5-commit-msg-checker
description: 'The gem5 commit message checker hook.' name: gem5 commit msg checker
- id: gerrit-commit-msg-job entry: ext/git-commit-msg
name: gerrit commit message job language: system
entry: util/gerrit-commit-msg-hook stages: [commit-msg]
language: system description: The gem5 commit message checker hook.
stages: [commit-msg] - id: gerrit-commit-msg-job
description: 'Adds Change-ID to the commit message. Needed by Gerrit.' name: gerrit commit message job
entry: util/gerrit-commit-msg-hook
language: system
stages: [commit-msg]
description: Adds Change-ID to the commit message. Needed by Gerrit.