Files
hunfabric/.pre-commit-config.yaml
2026-04-18 10:07:14 +02:00

190 lines
4.7 KiB
YAML

# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.86.0
hooks:
- id: terraform_fmt
- id: terraform_tflint
args:
- --args=--config=__GIT_WORKING_DIR__/.tflint.hcl
files: ^modules/
exclude: (tests/fixtures/|tools/lockfile/|^fast)
- repo: local
hooks:
- id: cff-readme
name: Regenerate README.md with tfdoc.py
entry: tools/pre-commit-tfdoc.sh
language: python
additional_dependencies:
- click
- ghapi
- iso8601
- marko
- requests
- yamale
- jsonschema
- BeautifulSoup4
# types: [terraform]
files: ^(modules|fast).*(tf|README.md)$
pass_filenames: true
require_serial: true
- id: licenese
name: Check license presence and other boilerplate checks
language: python
entry: tools/check_boilerplate.py
additional_dependencies:
- click
- ghapi
- iso8601
- marko
- requests
- yamale
- jsonschema
- BeautifulSoup4
pass_filenames: true
args:
- --scan-files
- id: tflint-fast
name: Checking FAST code with tflint
entry: tools/tflint-fast.py
language: python
additional_dependencies:
- click
- ghapi
- iso8601
- marko
- requests
- yamale
- jsonschema
- BeautifulSoup4
pass_filenames: true
require_serial: true
- id: versions
name: Align Terraform/OpenTofu provider versions
language: python
additional_dependencies:
- click
files: (versions.tf|^default-versions.tf|versions.tofu|default-versions.tofu)$
pass_filenames: false
entry: tools/versions.py --quiet
- id: check-names
name: Check name lengths for FAST
language: python
additional_dependencies:
- click
- ghapi
- iso8601
- marko
- requests
- yamale
- jsonschema
- BeautifulSoup4
pass_filenames: false
files: ^fast
entry: tools/check_names.py --prefix-length=10 --failed-only fast/stages
- id: check-yaml-schema
name: Check schema for YAML files
language: python
additional_dependencies:
- click
- ghapi
- iso8601
- marko
- requests
- yamale
- jsonschema
- BeautifulSoup4
pass_filenames: false
files: ^(fast|modules)
entry: tools/check_yaml_schema.py modules fast
- id: check-schema-docs
name: Check Markdown generated from JSON schemas
language: python
additional_dependencies:
- click
pass_filenames: false
files: ^(fast|modules).*schema\.json$
entry: tools/check_schema_docs.py --no-show-summary modules fast
- id: check-links
name: Check links in markdown files
language: python
additional_dependencies:
- click
- ghapi
- iso8601
- marko
- requests
- yamale
- jsonschema
- BeautifulSoup4
entry: tools/check_links.py --no-show-summary --scan-files
- id: duplicate-diff
name: duplicate-diff
entry: python3 tools/duplicate-diff.py
language: python
language_version: python3
files: '.*(\.sh|\.tf|\.tftpl|\.tpl|\.yaml)$'
pass_filenames: true
require_serial: true
- repo: https://github.com/adrienverge/yamllint
rev: 79a6b2b1392eaf49cdd32ac4f14be1a809bbd8f7 # v1.37.0
hooks:
- id: yamllint
args: ["-c=.yamllint", "--no-warnings"]
exclude: |
(?x)^(
/templates/.*|
modules/cloud-config-container/.*|
.*/0-org-setup/assets/workflow-.*\.yaml
)$
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: "3.0.0"
hooks:
- id: script-must-have-extension
- id: shellcheck
- id: shfmt
exclude: ".*tpl"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
args:
- --allow-multiple-documents
exclude: |
(?x)^(
/templates/.*|
modules/cloud-config-container/.*|
.*/0-org-setup/assets/workflow-.*\.yaml
)$
- repo: https://github.com/google/yapf/
rev: v0.40.2
hooks:
- id: yapf
require_serial: true
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
exclude: (requirements.txt$|excalidraw$|package-lock\.json$|go\.sum$|^CHANGELOG.md$)