-
Notifications
You must be signed in to change notification settings - Fork 31
/
.pre-commit-config.yaml
43 lines (43 loc) · 1.48 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
# Exclude hidden files, init, tensorrt folders, protobuf generated files, markdown files, and DB model.py files
exclude: ^(.*/\..*|.*__init__.py|.*_pb2.py|.*_pb2_grpc.py|.*.md|.*.database.*.models.py)$
default_language_version:
python: python3.9
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast # check if valid python file
stages: [commit]
- id: debug-statements # check if left in debug statements
stages: [commit]
- id: trailing-whitespace # remove trailing whitespace
stages: [commit]
- id: end-of-file-fixer # have one line at end of file
stages: [commit]
- id: check-docstring-first # File comments should come before imports
stages: [commit]
- id: check-yaml # make sure valid yaml
stages: [commit]
- id: name-tests-test # check that tests start with test_*
args: ['--pytest']
stages: [commit]
exclude: ^tests/helpers/
- id: check-added-large-files # check that we're not committing big files to git, excluding lfs files.
args: ['--maxkb=2000'] # set max file size to 2MB
stages: [commit]
- repo: https://github.com/asottile/pyupgrade # use Python3 tricks
rev: v2.32.0
hooks:
- id: pyupgrade
args: ['--keep-percent-format', '--keep-runtime-typing']
stages: [commit]
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.3
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format