-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
81 lines (76 loc) · 3.09 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
81 lines (76 loc) · 3.09 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
72
73
74
75
76
77
78
79
80
81
# Pre-commit hooks for GPEC repository
# Install: pip install pre-commit
# Setup: pre-commit install
# Run manually: pre-commit run --all-files
default_language_version:
python: python3.10
repos:
# Jupyter notebook cleaning - removes outputs, execution counts, metadata
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
name: Strip notebook outputs
args:
- --extra-keys
- |
metadata.kernelspec metadata.language_info.version
cell.metadata.executionInfo cell.metadata.colab
cell.metadata.id cell.metadata.scrolled
# General file cleanup
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
name: Trim trailing whitespace
- id: end-of-file-fixer
name: Fix end of files
- id: check-yaml
name: Check YAML syntax
- id: check-toml
name: Check TOML syntax
- id: check-added-large-files
name: Prevent large files
args: ['--maxkb=5000']
- id: mixed-line-ending
name: Fix line endings
args: ['--fix=lf']
# Julia code formatting
- repo: https://github.com/domluna/JuliaFormatter.jl
rev: v1.0.62
hooks:
- id: julia-formatter
name: Format Julia code
# Config-style TOML annotation conventions (docs/development/toml-conventions.md).
# pygrep hooks fail when the pattern matches, so each entry matches a violation.
- repo: local
hooks:
# Keeps the Area table in docs/development/naming.md matching src/ on disk,
# since the commit and PR title vocabulary is derived from it.
- id: naming-table-in-sync
name: 'Naming conventions: Area table matches src/'
language: system
entry: python3 ci/conventions/check_subject.py --check-table docs/development/naming.md
pass_filenames: false
files: ^(src/|docs/development/naming\.md$)
- id: toml-header-block
name: 'TOML conventions: file starts with a # header block'
language: pygrep
entry: '\A(?!#[^\n]*\n#)'
args: [--multiline]
files: ^(examples/.*\.toml|test/test_data/.*\.toml|regression-harness/cases/.*\.toml)$
- id: toml-no-decorative-dividers
name: 'TOML conventions: no decorative comment dividers'
language: pygrep
entry: '^#\s*[-=*_~#]{6,}\s*$'
files: ^(examples/.*\.toml|test/test_data/.*\.toml|regression-harness/cases/.*\.toml)$
- id: toml-inline-annotations
name: 'TOML conventions: every variable line has a # description'
language: pygrep
entry: '^[A-Za-z0-9_]+\s*=\s*[^#]*$'
files: ^(examples/.*\.toml|test/test_data/.*\.toml)$
- id: toml-no-deprecated-keys
name: 'TOML conventions: no deprecated config keys'
language: pygrep
entry: '^(mer_flag|force_wv_symmetry|ode_flag|cyl_flag|mat_flag|reform_eq_with_psilim|use_riccati|use_parallel|parallel_threads|populate_dense_xi|gal_flag|power_bp|power_b|power_r|power_rc)\s*='
files: ^(examples/.*\.toml|test/test_data/.*\.toml)$