Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
70 lines (61 loc) · 2.55 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
70 lines (61 loc) · 2.55 KB
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
63
64
65
66
67
68
69
70
# This file defines all the hooks run by pre-commit.
exclude: "poetry.lock"
repos:
# Base pre-commit hook repository, for simple checks & fixes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files # Prevent giant files from being committed
- id: check-ast # Check whether the files parse as valid Python
- id: check-docstring-first # Checks a common error of defining a docstring after code
- id: check-json # Check JSON files for parseable syntax
- id: check-merge-conflict # Check for files that contain merge conflict strings
- id: check-toml # Checks TOML files for parseable syntax
- id: check-yaml # Check YAML files for parseable syntax
- id: debug-statements # Check for debugger imports and `breakpoint()` calls in python
- id: detect-private-key # Detect the presence of private keys
- id: end-of-file-fixer # Ensures that files end with a newline
- id: name-tests-test # Verifies that test files are named correctly
- id: no-commit-to-branch # Don't commit directly on main
args: ["--branch", "main"]
- id: trailing-whitespace # Trims trailing whitespace
# nbstripout is used to remove Jupyter notebooks' cell outputs
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
# Black is an opinionated Python code formatter (with Jupyter notebook support)
- repo: https://github.com/psf/black
rev: 23.12.0
hooks:
- id: black-jupyter
# Isort is used to re-organize our import statements in Python
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--resolve-all-configs"]
# Prettier is a formatting tool for many non-Python files
# NOTE: version 4.0.0 seems broken up until 4.0.0-alpha.7 (errors happen both locally & on
# GH runners)
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
# TOML-sort is used to re-organize alphabetically TOML files (such as pyproject.toml)
- repo: https://github.com/pappasam/toml-sort
rev: v0.23.1
hooks:
- id: toml-sort
args: ["--all", "--in-place"]
# Flake8 is used to perform various code sanity checks in Python
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
exclude: notebooks/
# Safety is used to check if there are hardcoded secrets inside code and history
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.1
hooks:
- id: gitleaks