forked from NCAS-CMS/cfunits
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
78 lines (70 loc) · 2.97 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
# 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
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: v3.4.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 cfunits pyproject.toml file for our custom black configuration)
- repo: https://github.com/ambv/black
rev: 22.3.0
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 cfunits .pydocstyle.ini file for our custom configuration)
- repo: https://github.com/pycqa/pydocstyle
rev: 6.0.0
hooks:
- id: pydocstyle
# Additionally validate againt flake8 for other Python style enforcement
# (see https://flake8.pycqa.org/en/latest/ for documentation and see
# the cfunits .flake8 file for our custom flake8 configuration)
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.1
hooks:
- id: flake8
# Apply the 'isort' tool (fully compatible with 'black' after version 5
# which we surpass) to sort Python import statements systematically
# (see https://pycqa.github.io/isort/ for documentation). No further
# configuration is applied, nor required, than the below for a hook.
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- id: isort
name: isort (cython)
types: [cython]
- id: isort
name: isort (pyi)
types: [pyi]