lalib/.pre-commit-config.yaml
Alexander Hess 7a5246556a
Set up pre-commit hooks
- add pre-commit hooks:
  + run `nox -s lint` on staged *.py files
  + run common pre-commit hooks for validations that could not be
    achieved with tools in the develop environment so easily
- add pre-merge hook:
  + run `nox -s _pre-commit-test-hook` before merges
    * ignores the paths to staged files
      passed in by the pre-commit framework
    * runs all test cases instead
2024-09-10 02:32:56 +02:00

48 lines
1.1 KiB
YAML

default_stages:
- commit
fail_fast: true
repos:
- repo: local
hooks:
- id: local-lint
name: Lint the source files
entry: nox -s lint --
language: system
stages:
- commit
types:
- python
verbose: true
- id: local-test
name: Run the entire test suite
entry: nox -s _pre-commit-test-hook --
language: system
stages:
- merge-commit
types:
- text
verbose: true
- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: v4.6.0
hooks:
- id: check-added-large-files
args:
- "--maxkb=100"
- id: check-builtin-literals
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
stages:
- commit
- id: mixed-line-ending
args:
- "--fix=no"
- id: no-commit-to-branch
args:
- "--branch"
- main
- id: trailing-whitespace
stages:
- commit