Merge pull request #559 from dafyddj/test/pre-commit

test(pre-commit): switch to using `pre-commit`'s built-in file filtering
This commit is contained in:
Dafydd Jones 2023-11-10 16:43:39 +00:00 committed by GitHub
commit 8ded2cecdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 34 deletions

View File

@ -45,9 +45,33 @@ repos:
hooks: hooks:
- id: yamllint - id: yamllint
name: Check YAML syntax with yamllint name: Check YAML syntax with yamllint
args: [--strict, '.'] args: [--strict]
always_run: true types: [file]
pass_filenames: false # Files to include
# 1. Obvious YAML files
# 2. `pillar.example` and similar files
# 3. SLS files under directory `test/` which are pillar files
# Files to exclude
# 1. SLS files under directory `test/` which are state files
# 2. `kitchen.vagrant.yml`, which contains Embedded Ruby (ERB) template syntax
# 3. YAML files heavily reliant on Jinja
files: |
(?x)^(
.*\.yaml|
.*\.yml|
\.salt-lint|
\.yamllint|
.*\.example|
test/.*\.sls
)$
exclude: |
(?x)^(
kitchen.vagrant.yml|
test/.*/states/.*\.sls|
salt/osfamilymap.yaml|
salt/osmap.yaml|
salt/osfingermap.yaml
)$
- repo: https://github.com/warpnet/salt-lint - repo: https://github.com/warpnet/salt-lint
rev: v0.9.2 rev: v0.9.2
hooks: hooks:

View File

@ -4,37 +4,6 @@
# Extend the `default` configuration provided by `yamllint` # Extend the `default` configuration provided by `yamllint`
extends: 'default' extends: 'default'
# Files to ignore completely
# 1. All YAML files under directory `.bundle/`, introduced if gems are installed locally
# 2. All YAML files under directory `.cache/`, introduced during the CI run
# 3. All YAML files under directory `.git/`
# 4. All YAML files under directory `node_modules/`, introduced during the CI run
# 5. Any SLS files under directory `test/`, which are actually state files
# 6. Any YAML files under directory `.kitchen/`, introduced during local testing
# 7. `kitchen.vagrant.yml`, which contains Embedded Ruby (ERB) template syntax
# 8. All YAML files heavily reliant on Jinja; these can be tackled in a subsequent PR
ignore: |
.bundle/
.cache/
.git/
node_modules/
test/**/states/**/*.sls
.kitchen/
kitchen.vagrant.yml
salt/osfamilymap.yaml
salt/osmap.yaml
salt/osfingermap.yaml
yaml-files:
# Default settings
- '*.yaml'
- '*.yml'
- .salt-lint
- .yamllint
# SaltStack Formulas additional settings
- '*.example'
- test/**/*.sls
rules: rules:
empty-values: empty-values:
forbid-in-block-mappings: true forbid-in-block-mappings: true