78 lines
2.6 KiB
YAML
78 lines
2.6 KiB
YAML
# Copyright 2026 Schwarz Digits Cloud GmbH & Co. KG
|
|
#
|
|
# 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.
|
|
|
|
# .pre-commit-config.yaml
|
|
# To use this file, install pre-commit (https://pre-commit.com):
|
|
# pip install pre-commit
|
|
# Then install the hooks in your repo:
|
|
# pre-commit install
|
|
# To run on all files manually:
|
|
# pre-commit run --all-files
|
|
|
|
repos:
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v4.5.0
|
|
hooks:
|
|
- id: trailing-whitespace
|
|
- id: end-of-file-fixer
|
|
- id: check-yaml
|
|
args: [--allow-multiple-documents]
|
|
- id: check-added-large-files
|
|
|
|
- repo: https://github.com/antonbabenko/pre-commit-terraform
|
|
rev: v1.88.0
|
|
hooks:
|
|
- id: terraform_fmt
|
|
args:
|
|
- --args=-recursive
|
|
|
|
- repo: https://github.com/psf/black
|
|
rev: 24.3.0
|
|
hooks:
|
|
- id: black
|
|
|
|
- repo: https://github.com/dnephin/pre-commit-golang
|
|
rev: v0.5.1
|
|
hooks:
|
|
- id: go-fmt
|
|
|
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
rev: v3.1.0
|
|
hooks:
|
|
- id: prettier
|
|
types_or: [javascript, yaml, json, markdown]
|
|
|
|
- repo: https://github.com/gitleaks/gitleaks
|
|
rev: v8.24.2
|
|
hooks:
|
|
- id: gitleaks
|
|
|
|
- repo: local
|
|
hooks:
|
|
# Requires `addlicense` to be installed locally (go install github.com/google/addlicense@latest)
|
|
- id: addlicense
|
|
name: Add License Headers
|
|
description: Ensures all files have the Apache 2.0 license header (skips files starting with #cloud-config)
|
|
entry: bash -c 'for f in "$@"; do head -n 1 "$f" | grep -q "^#cloud-config" || addlicense -c "Schwarz Digits Cloud GmbH & Co. KG" -l apache "$f"; done' --
|
|
language: system
|
|
types_or: [terraform, python, go, javascript, yaml, json, html, css]
|
|
pass_filenames: true
|
|
|
|
- id: terraform-numbered-files
|
|
name: Terraform Files Must Have Number Prefix
|
|
description: Ensures all committed .tf files in examples start with exactly 3 digits (e.g., 010-, 020-, 100-). Module files are exempt.
|
|
entry: scripts/check-terraform-numbered-files.sh
|
|
language: script
|
|
types: [terraform]
|
|
pass_filenames: true
|