-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
77 lines (74 loc) · 3.46 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
77 lines (74 loc) · 3.46 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
# Pre-commit hooks — https://pre-commit.com
# Install once per clone with: pre-commit install
# Run on the whole tree with: pre-commit run --all-files
#
# Mirror the ruff config in pyproject.toml so a pre-commit run and a
# direct ``ruff check`` produce identical results.
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
# The Apache 2.0 LICENSE text has significant trailing
# whitespace on a couple of indented appendix lines (keep
# verbatim for license-detection tools); vendored BModes /
# OpenFAST data ships in upstream-specified formatting.
exclude: ^(LICENSE|src/pybmodes/_examples/|external/).*$
- id: end-of-file-fixer
# Same exclusions as trailing-whitespace, for the same reason.
exclude: ^(LICENSE|src/pybmodes/_examples/|external/).*$
- id: check-yaml
# GitHub Actions workflows use ``on:`` which YAML aliases to
# the boolean ``True``; allow that.
args: ["--unsafe"]
- id: check-toml
- id: check-merge-conflict
- id: check-added-large-files
args: ["--maxkb=2000"]
- id: mixed-line-ending
args: ["--fix=lf"]
# The tracked decks under ``_examples/`` are already normalized
# to LF by ``.gitattributes`` (``*.bmi`` / ``*.dat`` / ``*.out``
# → ``eol=lf``), so this fixer is redundant on them and they are
# excluded to avoid a no-op churn pass. The gitignored upstream
# clones under ``external/`` keep their native upstream line
# endings, and the Windows-authored Sphinx ``make.bat`` stays
# CRLF. (Validation hashing is line-ending-normalized, so deck
# EOLs don't affect the integrity contract regardless.)
exclude: ^(docs/make\.bat|src/pybmodes/_examples/|external/).*$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
hooks:
- id: ruff
args: ["--fix", "--exit-non-zero-on-fix"]
# Same scope as CI (.github/workflows/ci.yml).
files: ^(src|tests|scripts)/
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
# Project terms / variable names that trip the dictionary.
# ``unparseable`` is the spelling our error messages use;
# ``fo`` is a coordinate-axis variable name in
# ``io/_precomp/arc_resolver.py``; ``re-use`` is a style
# choice. Move large lists into ``.codespellrc`` if this
# gets unwieldy.
args:
- --ignore-words-list=fro,iy,nd,te,ot,bu,arange,ND,Nd,unparseable,fo,re-use
exclude: ^(LICENSE|CHANGELOG\.md|external/|.*\.bmi$|.*\.dat$|.*\.out$|.*\.ipynb$)
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
- id: insert-license
name: Apache 2.0 header (Python source + scripts + cases)
# Scope mirrors the one-shot scaffold: src/pybmodes/, scripts/,
# cases/, plus noxfile.py at the repo root. Tests deliberately
# excluded — test files conventionally don't carry the header.
files: ^(src/pybmodes/.*\.py|scripts/.*\.py|cases/.*\.py|noxfile\.py)$
args:
- --license-filepath=.license_header.txt
- --comment-style=#
# The header is 14 lines; scan a little further so we still
# detect it when a future shebang or coding declaration
# pushes the marker line down.
- --detect-license-in-X-top-lines=20