-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
71 lines (67 loc) · 2.89 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
71 lines (67 loc) · 2.89 KB
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
default_language_version:
python: python3
# The vendored ICON submodule is never ours to reformat.
exclude: '^tests/icon/full/icon-model/'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
# The committed .f90 single-TU fixtures are byte-compared by drift-guard tests
# against fresh inliner output, so a whitespace hook must never mutate them.
# .patch context/blank lines carry significant leading whitespace -- never touch.
exclude: '\.(f90|F90|patch)$'
- id: trailing-whitespace
exclude: '\.(f90|F90|patch)$'
# --- Python: yapf (column_limit=120 in .style.yapf) ---
- repo: https://github.com/google/yapf
rev: v0.43.0
hooks:
- id: yapf
name: yapf
language: python
entry: yapf
types: [python]
# --- C++ / Fortran: the locally-installed clang-format / fprettify, so the hook
# formats with the SAME version the code was written against (no mirror-version
# skew, no churn on the existing tree). Both read the repo-root config files
# (.clang-format, .fprettify.rc). CI installs both before running pre-commit. ---
- repo: local
hooks:
- id: clang-format
name: clang-format (.clang-format, ColumnLimit 120)
entry: clang-format
language: system
args: ['-i']
files: '\.(cpp|h)$'
# Vendored dwarf-p-cloudsc (Apache-2.0, see NOTICE): upstream C++/CUDA sources, plus
# common/include/*.h COMDECKs that are actually Fortran text under a .h name -- clang-format
# mangles the latter outright (verified). Never reformat vendored upstream source.
exclude: '^tests/cloudsc/variants/dwarf-p-cloudsc/'
- id: fprettify
name: fprettify (.fprettify.rc, line-length 120)
entry: fprettify
language: system
args: ['-c', '.fprettify.rc']
files: '\.(f90|F90)$'
# Every .f90 in the repo is a drift-guarded generated single-TU fixture or a
# deliberately-shaped parser/bridge test vector -- not library source. Narrow
# this exclude to opt a hand-written Fortran directory into formatting.
exclude: '^tests/'
# Copyright / SPDX header on the CORE package (scope lives in the script:
# dace_fortran/ only -- tests/ and top-level scripts/ are a deferred pass).
- id: dace-fortran-headers
name: copyright / SPDX header (core package)
# --fix ADDS the header (as the first content line, after any shebang) rather than only
# failing -- the same auto-fix contract as the other formatting hooks above.
entry: python scripts/check_headers.py --fix
language: system
require_serial: true
files: '\.py$'
# Reject any staged file over 500 KiB (keep datasets / binaries / dumps out of git).
- id: dace-fortran-large-files
name: block files > 500 KiB
entry: python scripts/check_large_files.py
language: system