mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
🎉 run code quality checks automatically
* installs black and flake8 as pre-commit hooks * runs only on modified files
This commit is contained in:
parent
bb781ae7f7
commit
a0004349f3
10
.pre-commit-config.yaml
Normal file
10
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/ambv/black
|
||||||
|
rev: 21.6b0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
language_version: python3.7
|
||||||
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
|
rev: 3.9.2
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
|
@ -177,6 +177,15 @@ tools installed.
|
||||||
**⚠️ Note that formatting and linting is currently only possible for Python
|
**⚠️ Note that formatting and linting is currently only possible for Python
|
||||||
modules in `.py` files, not Cython modules in `.pyx` and `.pxd` files.**
|
modules in `.py` files, not Cython modules in `.pyx` and `.pxd` files.**
|
||||||
|
|
||||||
|
### Pre-Commit Hooks
|
||||||
|
|
||||||
|
After cloning the repo, after installing the packages from `requirements.txt`, enter the repo folder and run `pre-commit install`.
|
||||||
|
Each time a `git commit` is initiated, `black` and `flake8` will run automatically on the modified files only.
|
||||||
|
|
||||||
|
In case of error, or when `black` modified a file, the modified file needs to be `git add` once again and a new
|
||||||
|
`git commit` has to be issued.
|
||||||
|
|
||||||
|
|
||||||
### Code formatting
|
### Code formatting
|
||||||
|
|
||||||
[`black`](https://github.com/ambv/black) is an opinionated Python code
|
[`black`](https://github.com/ambv/black) is an opinionated Python code
|
||||||
|
|
|
@ -22,6 +22,7 @@ setuptools
|
||||||
packaging>=20.0
|
packaging>=20.0
|
||||||
typing_extensions>=3.7.4.1,<4.0.0.0; python_version < "3.8"
|
typing_extensions>=3.7.4.1,<4.0.0.0; python_version < "3.8"
|
||||||
# Development dependencies
|
# Development dependencies
|
||||||
|
pre-commit>=2.13.0
|
||||||
cython>=0.25,<3.0
|
cython>=0.25,<3.0
|
||||||
pytest>=5.2.0
|
pytest>=5.2.0
|
||||||
pytest-timeout>=1.3.0,<2.0.0
|
pytest-timeout>=1.3.0,<2.0.0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user