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
This commit is contained in:
parent
c07a9ed19f
commit
7a5246556a
5 changed files with 196 additions and 2 deletions
48
.pre-commit-config.yaml
Normal file
48
.pre-commit-config.yaml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue