Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repos:
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
files: '^.*\.py'
types: [file]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
args: ['--extend-ignore=E203', '--max-line-length=88']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

black では : の前にスペースを入れるのですが、 flake8 ではそれがエラーとなってしまうので、それを無視する設定を入れています。
psf/black#1437

files: '^.*\.py'
types: [file]
- repo: https://github.com/pycqa/isort
rev: 5.6.4
hooks:
- id: isort
args: ['--profile', 'black']
files: '^.*\.py'
types: [file]
15 changes: 14 additions & 1 deletion contributing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,18 @@ $ pip install -r contributing/requirements.txt
### Run Formatter and Linter

```bash
make all
$ make all
```

### Enable pre-commit hook

```bash
$ pre-commit install
```

Basically, `pre-commit` will only run on the changed files.
But if you execute the bellow command, you can run on all files.

```bash
$ pre-commit run --all-files
```
3 changes: 2 additions & 1 deletion contributing/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
black==20.8b1
flake8==3.8.4
isort==5.6.4
isort==5.6.4
pre-commit==2.16.0