pre-commit: Add an initial configuration file

Add (except some meta-hooks) the `check-case-conflict` hook to
make sure the repo don't contain files that can cause a conflict
on case-insensitive filesystems.

Also, exclude third-party sources from further checks.
This commit is contained in:
Alex Turbov 2025-01-04 19:25:24 +04:00
parent 8eff0d3351
commit de59765336
No known key found for this signature in database
GPG Key ID: 8BEDB7D11F95D5E3

34
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,34 @@
# Read the docs here: https://pre-commit.com
# List of some available hooks: https://pre-commit.com/hooks.html
#
# Install `pre-commit`:
#
# $ pip install pre-commit
#
# Install hooks to your clone:
# $ pre-commit install
#
default_stages: [pre-commit]
default_install_hook_types: [pre-commit]
fail_fast: false
# NOTE Exclude third-party sources and some files globally.
# See `Utilities/Scripts/update-*.bash` scripts and
# https://pre-commit.com/#regular-expressions
exclude: >-
(?x)Auxiliary/vim
| Licenses/.*\.txt$
| Source/(CursesDialog/form|kwsys)
| Utilities/(cm.*|GitSetup|KWIML)
| .*\.patch$
repos:
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-case-conflict