forked from openPMD/openPMD-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
136 lines (123 loc) · 3.67 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://pre-commit.com for more information
# Do not check/format anything from third parties
exclude: '^share/openPMD/thirdParty'
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: mixed-line-ending
- id: check-json
- id: check-toml
- id: check-yaml
args: [--allow-multiple-documents]
- id: check-added-large-files
args: ['--maxkb=80']
- id: requirements-txt-fixer
# - id: fix-encoding-pragma
# exclude: ^noxfile.py$
# documentation files: .rst
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
#- repo: https://github.com/asottile/pyupgrade
# rev: v2.29.0
# hooks:
# - id: pyupgrade
# Changes tabs to spaces
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.1
hooks:
- id: remove-tabs
# CMake formatting
#- repo: https://github.com/cheshirekow/cmake-format-precommit
# rev: v0.6.13
# hooks:
# - id: cmake-format
# additional_dependencies: [pyyaml]
# types: [file]
# files: (\.cmake|CMakeLists.txt)(.in)?$
# C++ formatting
# clang-format v13
# to run manually, use .github/workflows/clang-format/clang-format.sh
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
hooks:
- id: clang-format
# By default, the clang-format hook configures:
# 'types_or': [c++, c, c#, cuda, java, javascript, json, objective-c, proto, textproto]
# Unfortunately, the c++ option does not recognize .tpp files, so we need to do this manually
# Since file filters in pre-commit work by logical AND, it's only possible to narrow the filter definition
# So, we add a regex for the type of file that we want and additionally disable the 'types_or'
# option entirely.
'types_or': []
files: .*\.(tpp|h|hpp|hpp\.in|cpp|cxx|js|json)$
# Autoremoves unused Python imports
- repo: https://github.com/hadialqattan/pycln
rev: v2.1.6
hooks:
- id: pycln
name: pycln (python)
# Sorts Python imports according to PEP8
# https://www.python.org/dev/peps/pep-0008/#imports
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
# Python: Flake8 (checks only, does this support auto-fixes?)
#- repo: https://github.com/PyCQA/flake8
# rev: 4.0.1
# hooks:
# - id: flake8
# additional_dependencies: &flake8_dependencies
# - flake8-bugbear
# - pep8-naming
# exclude: ^(docs/.*|tools/.*)$
# Alternatively: use autopep8?
# Python Formatting
#- repo: https://github.com/psf/black
# rev: 21.10b0 # Keep in sync with blacken-docs
# hooks:
# - id: black
#- repo: https://github.com/asottile/blacken-docs
# rev: v1.11.0
# hooks:
# - id: blacken-docs
# additional_dependencies:
# - black==21.10b0 # keep in sync with black hook
# Jupyter Notebooks: clean up all cell outputs
- repo: https://github.com/roy-ht/pre-commit-jupyter
rev: v1.2.1
hooks:
- id: jupyter-notebook-cleanup
args:
- --pin-patterns
- "[pin];[donotremove]"
# - --remove-kernel-metadata
# Checks the manifest for missing files (native support)
- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
hooks:
- id: check-manifest
# This is a slow hook, so only run this if --hook-stage manual is passed
stages: [manual]
additional_dependencies: [cmake, ninja]