Skip to content

Commit 54e0ee4

Browse files
authored
Merge pull request #96 from fastlabel/feature/886-precommit-hook
Add code formatter
2 parents 0566a49 + b3bce7c commit 54e0ee4

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 20.8b1
4+
hooks:
5+
- id: black
6+
files: '^.*\.py'
7+
types: [file]
8+
- repo: https://gitlab.com/pycqa/flake8
9+
rev: 3.8.4
10+
hooks:
11+
- id: flake8
12+
args: ['--extend-ignore=E203', '--max-line-length=88']
13+
files: '^.*\.py'
14+
types: [file]
15+
- repo: https://github.com/pycqa/isort
16+
rev: 5.6.4
17+
hooks:
18+
- id: isort
19+
args: ['--profile', 'black']
20+
files: '^.*\.py'
21+
types: [file]

contributing/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,18 @@ $ pip install -r contributing/requirements.txt
1818
### Run Formatter and Linter
1919

2020
```bash
21-
make all
21+
$ make all
22+
```
23+
24+
### Enable pre-commit hook
25+
26+
```bash
27+
$ pre-commit install
28+
```
29+
30+
Basically, `pre-commit` will only run on the changed files.
31+
But if you execute the bellow command, you can run on all files.
32+
33+
```bash
34+
$ pre-commit run --all-files
2235
```

contributing/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
black==20.8b1
22
flake8==3.8.4
3-
isort==5.6.4
3+
isort==5.6.4
4+
pre-commit==2.16.0

0 commit comments

Comments
 (0)