Skip to content

Commit

Permalink
Add pre-commit hook.
Browse files Browse the repository at this point in the history
  • Loading branch information
shaoyijia committed Sep 4, 2024
1 parent 28cfb4b commit 959f39e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
name: Format Python code with black
entry: black
args: ["knowledge_storm/"]
language: python
pass_filenames: true
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ Following the suggested format can lead to a faster review process.
**Code Format:**
We adopt [`black`](https://github.com/psf/black) for arranging and formatting Python code. Please complete the following step before submitting the PR. See [here](https://github.com/psf/black?tab=readme-ov-file#installation-and-usage) for more information.
```shell
pip install black
black {path_to_the_changed_python_code}
We adopt [`black`](https://github.com/psf/black) for arranging and formatting Python code. To streamline the contribution process, we set up a [pre-commit hook](https://pre-commit.com/) to format the code under `knowledge_storm/` before committing. To install the pre-commit hook, run:
```

pip install pre-commit
pre-commit install
```
The hook will automatically format the code before each commit.

0 comments on commit 959f39e

Please sign in to comment.