Skip to content

Commit 942a284

Browse files
Merge pull request #3 from pybamm-team/pre-commit-hooks
Add `pre-commit` hooks
2 parents 81b5890 + 723a308 commit 942a284

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,4 @@ cython_debug/
122122
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
123123
# and can be added to the global gitignore or merged into this file. For a more nuclear
124124
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
125-
#.idea/
125+
#.idea/

.pre-commit-config.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
4+
ci:
5+
autoupdate_commit_msg: "chore: update pre-commit hooks"
6+
autofix_commit_msg: "style: pre-commit fixes"
7+
8+
repos:
9+
10+
# Standard and general-purpose hooks
11+
12+
- repo: https://github.com/pre-commit/pre-commit-hooks
13+
rev: v4.4.0
14+
hooks:
15+
- id: trailing-whitespace
16+
- id: end-of-file-fixer
17+
- id: check-yaml
18+
- id: check-added-large-files
19+
- id: mixed-line-ending
20+
21+
- repo: https://github.com/codespell-project/codespell
22+
rev: v2.2.5
23+
hooks:
24+
- id: codespell
25+
26+
- repo: local
27+
hooks:
28+
- id: disallow-caps
29+
name: Disallow improper capitalization
30+
language: pygrep
31+
entry: Numpy|Scipy|Cmake|Github|Pybamm
32+
exclude: .pre-commit-config.yaml
33+
34+
# Python files
35+
36+
- repo: https://github.com/astral-sh/ruff-pre-commit
37+
rev: v0.0.281
38+
hooks:
39+
- id: ruff
40+
args: ["--fix", "--show-fixes"]
41+
42+
# Documentation files
43+
44+
- repo: https://github.com/asottile/blacken-docs
45+
rev: "1.15.0"
46+
hooks:
47+
- id: blacken-docs
48+
additional_dependencies: [black==23.7.0]
49+
50+
- repo: https://github.com/pre-commit/pygrep-hooks
51+
rev: "v1.10.0"
52+
hooks:
53+
- id: rst-backticks
54+
- id: rst-directive-colons
55+
- id: rst-inline-touching-normal
56+
57+
# Jupyter notebooks
58+
59+
- repo: https://github.com/nbQA-dev/nbQA
60+
rev: "1.7.0"
61+
hooks:
62+
- id: nbqa-ruff
63+
additional_dependencies: [ruff==0.0.281]

0 commit comments

Comments
 (0)