-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
62 lines (62 loc) · 2.2 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# See https://pre-commit.com/ for usage and config
fail_fast: true
repos:
# https://github.com/pre-commit/pre-commit-hooks/releases/tag/v4.3.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
args: [ --fix, auto ]
- id: check-json
- id: check-yaml
- id: check-toml
- id: debug-statements
- id: name-tests-test
args: [ --pytest-test-first ]
- id: check-case-conflict
- repo: local
hooks:
- id: poetry-check
name: Poetry Check
stages: [ commit ]
language: python
entry: poetry check
pass_filenames: false
files: ^(.*/)?(poetry\.lock|pyproject\.toml)$
- id: ruff-format
name: Ruff Check and Fix
stages: [ commit ]
language: system
# Ruff checks and fixes Python code for both /src and /tests directories
entry: poetry run ruff check .
types: [ python ]
args:
- "--fix"
- id: mypy
name: mypy
stages: [ commit ]
language: system
entry: poetry run mypy
types: [ python ]
require_serial: true
- id: pytest
name: Pytest Unit Tests
stages: [ commit ]
language: system
# https://github.com/pytest-dev/pytest/issues/5502#issuecomment-1020761655
# Prevent Pytest logging error like: ValueError: I/O operation on closed file.
entry: env LOG_LEVEL=DEBUG poetry run pytest --cov --cov-report html --html=./build/.pytest_report/report.html --self-contained-html --log-cli-level=DEBUG -n auto --benchmark-disable
types: [ python ]
pass_filenames: false
- id: pytest-cov
name: Pytest with Coverage
stages: [ push ]
language: system
# https://github.com/pytest-dev/pytest/issues/5502#issuecomment-1020761655
# Prevent Pytest logging error like: ValueError: I/O operation on closed file.
entry: env LOG_LEVEL=ERROR poetry run pytest --cov --cov-fail-under=90 --capture=no --log-cli-level=ERROR -n auto
types: [ python ]
pass_filenames: false