-
Notifications
You must be signed in to change notification settings - Fork 129
/
.pre-commit-config.yaml
41 lines (41 loc) · 1.5 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
# pre-commit hooks require a user to have installed `pre-commit`:
# $ brew install pre-commit
# Then install the hooks within the repo:
# $ cd /PATH/TO/REPO
# $ pre-commit install
exclude: '^docs/code-comparisons/' # skip the code comparisons directory
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.7
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
# args: [ --diff ] # Use for previewing changes
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
# ensures files are either empty or end with a blank line
- id: end-of-file-fixer
# sorts requirements
- id: requirements-txt-fixer
# valid python file
- id: check-ast
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
- repo: local
hooks:
- id: validate-example-notebooks
name: validate example notebooks
entry: python ./examples/validate_examples.py # script is called from root directory
language: python # script requires the Python interpreter
require_serial: true # don't run in parallel because one call of the script parses all files
additional_dependencies: [nbformat] # Python dependency for the script
files: ^examples/.*\.ipynb$ # this catches all .ipynb under examples/
types: [jupyter] # jupyter is alias for .ipynb files