Skip to content

Commit 724d839

Browse files
committed
pre-commit: Add configuration to check coding style on commit
Also document the usage in CONTRIBUTING.md.
1 parent 5fddd9f commit 724d839

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

.pre-commit-config.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: codeformat_c
5+
name: codeformat-c
6+
language: system
7+
entry: poetry run ./tools/codeformat.py -cf
8+
types: [c]
9+
- id: codeformat_py
10+
name: codeformat-py
11+
language: system
12+
entry: poetry run ./tools/codeformat.py -p
13+
types: [python]
14+
pass_filenames: false

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,13 @@ Before committing your changes, be sure to run:
215215
This will automatically fix common problems in files that follow the MicroPython
216216
style.
217217

218+
This can be run automatically using pre-commit. Install pre-commit, then run:
219+
220+
pre-commit install
221+
222+
It will install a pre-commit hook for this repository. On every commit, the
223+
coding style will be checked before the commit is done.
224+
218225

219226
### Logical commits
220227

0 commit comments

Comments
 (0)