-
Notifications
You must be signed in to change notification settings - Fork 11
/
.pre-commit-config.yaml
80 lines (72 loc) · 3.17 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
75
76
77
78
79
80
# 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\/1\..*\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 cfdm pyproject.toml file for our custom black configuration)
- repo: https://github.com/ambv/black
rev: 24.4.2
hooks:
- id: black
language_version: python3
# 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.4
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 72 characters (the latter
# by default).
args: [--in-place, --blank, --wrap-summaries=72]
# Check the docstrings conforms to Google docstring format as much as can
# be detected by the 'pydocstyle' checker
# (see http://www.pydocstyle.org/en/stable/index.html for
# docs and see the cfdm .pydocstyle.ini file for our custom configuration)
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
- id: pydocstyle
# pydocstyle bug, see https://github.com/PyCQA/pydocstyle/issues/526
exclude: 'cfdm/functions.py' # TODO: remove exclusion when bug fixed
# Additionally validate againt flake8 for other Python style enforcement
# (see https://flake8.pycqa.org/en/latest/ for documentation and see
# the cfdm .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]