Add pre-commit plugin for black/isort/flake8 (#1398)

* Add pre-commit plugin for black/isort/flake8

* Update .pre-commit-config.yaml

* Add a few more useful hooks
This commit is contained in:
Wan Liuyang
2020-02-13 18:49:35 +08:00
committed by GitHub
parent 125536fe69
commit 08b1c474b3
3 changed files with 35 additions and 2 deletions
+1 -1
View File
@@ -4,5 +4,5 @@ include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88
known_third_party=deprecated,httpretty,jwt,parameterized,requests,setuptools,six,urllib3
known_third_party=deprecated,httpretty,jwt,parameterized,requests,setuptools,urllib3
known_first_party=github
+23
View File
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
language_version: python3.6
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.4
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
+11 -1
View File
@@ -23,7 +23,7 @@ Pull Requests should clearly describe two things:
Ideally, changes should be made in logical commits and tests added to improve the project's coverage of the GitHub API.
## Coding conventions
## Coding style
PyGithub adopts the black coding style and uses isort to sort imports.
@@ -32,6 +32,16 @@ To manually format the code:
tox -e format
```
## Pre-commit plugin
To forget about coding style and let [pre-commit](https://pre-commit.com/#installation) fix your flake8/isort/black issue.
```
pre-commit install
```
That's it!
## Adding missing attributes for a GithubObject
```bash