From 966d85905079ac7f9297bb1f269cb73042675813 Mon Sep 17 00:00:00 2001 From: Ralph Sennhauser Date: Thu, 5 Sep 2024 09:46:13 +0200 Subject: [PATCH] Add yamllint to pre-commit Adding a hook to pre-commit to enforce a consistent style and remove the hook check-yaml which only checks if a document is parsable and so become redundant. Signed-off-by: Ralph Sennhauser --- .pre-commit-config.yaml | 8 +++++++- .yamllint.yaml | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .yamllint.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d47ac6584..40bf599453 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,6 @@ repos: ^binaries/data/mods/_test.sim/simulation/templates.illformed.xml| ^binaries/data/mods/public/maps/.*\.xml ) - - id: check-yaml - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.6.1 hooks: @@ -69,3 +68,10 @@ repos: ^build/premake/| ^source/third_party/ ) + - repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint + args: + - --strict + exclude: ^build/premake/premake5/ diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000000..b0178ffe37 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,8 @@ +--- +# https://yamllint.readthedocs.io/en/stable/index.html +extends: default +rules: + line-length: + max: 100 + truthy: + check-keys: false