urban-meal-delivery/.pre-commit-config.yaml
Alexander Hess 4ee5a50fc6
Simplify the pre-commit hooks
- run "format" and "lint" separately
  => remove the nox session "pre-commit"
- execute the entire "test-suite" before merges
  + rename "pre-merge" into "test-suite"
  + do not "format" and "lint" here any more
  + do not execute this before pushes
    * allow branches with <100% test coverage to exist on GitHub
      (they cannot be merged into 'main' until 100% coverage)
    * GitHub Actions executes the test suite
2020-08-11 10:41:43 +02:00

50 lines
1.4 KiB
YAML

default_stages: [commit] # only used if a hook does not specify stages
fail_fast: true
repos:
# Run the local formatting, linting, and testing tool chains.
- repo: local
hooks:
- id: local-format
name: Format the source files
entry: poetry run nox -s format --
language: system
stages: [commit]
types: [python]
- id: local-lint
name: Lint the source files
entry: poetry run nox -s lint --
language: system
stages: [commit]
types: [python]
- id: local-fix-branch-references
name: Adjust the branch references
entry: poetry run nox -s fix-branch-references --
language: system
stages: [commit]
types: [text]
- id: local-test-suite
name: Run the entire test suite
entry: poetry run nox -s test-suite --
language: system
stages: [merge-commit]
types: [text]
# Enable hooks provided by the pre-commit project to
# enforce rules that local tools could not that easily.
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-added-large-files
args: [--maxkb=100]
- id: check-case-conflict
- id: check-builtin-literals
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
stages: [commit] # overwrite the default
- id: mixed-line-ending
args: [--fix=no]
- id: no-commit-to-branch
args: [--branch, main]
- id: trailing-whitespace
stages: [commit] # overwrite the default