-
Notifications
You must be signed in to change notification settings - Fork 19
/
.pre-commit-config.yaml
74 lines (67 loc) · 2.94 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
63
64
65
66
67
68
69
70
71
72
73
74
# Configure pre-commit hooks to check for Python code validity, formatting and
# style issues and prompt for these to be corrected before committing.
# Excludes for *all* pre-commit hooks as listed below:
# (these are documentation files, either old ones or aut-generated ones)
exclude: docs\/3\..*\d\/|docs\/_downloads\/|docs\/.*\/tutorial\.py
repos:
# Use specific format-enforcing pre-commit hooks from the core library
# with the default configuration (see pre-commit.com for documentation)
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-ast
- id: debug-statements
- id: end-of-file-fixer
types: [python]
- id: trailing-whitespace
types: [python]
# Also validate against 'black' for unambiguous Python formatting
# (see https://black.readthedocs.io/en/stable/ for documentation and see
# the cf-python pyproject.toml file for our custom black configuration)
- repo: https://github.com/ambv/black
rev: 24.4.2
hooks:
- id: black
language_version: python3
# NOTE: docformatter inclusion has been halted by commenting out this
# block, since at the moment it is too strict and has too many bugs
# relating to Sphinx admonition usage to be practically helpful.
# TODO revisit its usage in future.
#
# Also format docstrings in a consistent way, on top of 'black' requirements
# with the aim to auto-correct towards the Google docstring format (see
# https://google.github.io/styleguide/pyguide.html#381-docstrings) as much
# as possible (see https://github.com/myint/docformatter for docs, with
# configuration as below)
# - repo: https://github.com/myint/docformatter
# rev: v1.6.0.rc1
# hooks:
# - id: docformatter
# # These arguments act as the configuration for docformatter. They:
# # * make docformatter auto-format in-place if not compliant;
# # * ensure there is a blank line after the final non-empty line;
# # * wraps both summary and description at 79 characters (the latter
# # by default).
# args: [--in-place, --blank, --wrap-summaries=60]
# Additionally validate againt flake8 for other Python style enforcement
# (see https://flake8.pycqa.org/en/latest/ for documentation and see
# the cf-python .flake8 file for our custom flake8 configuration)
- repo: https://github.com/PyCQA/flake8
rev: 7.1.0
hooks:
- id: flake8
# Apply the 'isort' tool to sort Python import statements systematically
# (see https://pycqa.github.io/isort/ for documentation). It is fully
# compatible with 'black' with the lines set to ensure so in the repo's
# pyproject.toml. Other than that and the below, no extra config is required.
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
- id: isort
name: isort (cython)
types: [cython]
- id: isort
name: isort (pyi)
types: [pyi]