Skip to content

Commit 9eb3623

Browse files
schodetdlech
authored andcommitted
pre-commit: Add configuration to check coding style on commit
Also document the usage in CONTRIBUTING.md.
1 parent 62f31b5 commit 9eb3623

File tree

4 files changed

+130
-1
lines changed

4 files changed

+130
-1
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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,16 @@ 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 before making a commit using [pre-commit][]. To
219+
enable it, run:
220+
221+
poetry run pre-commit install
222+
223+
It will install a pre-commit git hook for this repository. On every commit,
224+
the coding style will be checked and fixed before the commit is done.
225+
226+
[pre-commit]: https://pre-commit.com/
227+
218228

219229
### Logical commits
220230

poetry.lock

Lines changed: 105 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ python-dotenv = "^0.15.0"
2323
python-socketio = "^5.7.2"
2424
scipy = "^1.8.1"
2525
sympy = "^1.10.1"
26+
pre-commit = ">=3.6.2"
2627

2728
[tool.poetry.group.stats.dependencies]
2829
azure-data-tables = "^12.4.2"

0 commit comments

Comments
 (0)