mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-30 05:32:30 +08:00
CONTRIBUTING: introduce pre-commit (#2479)
This commit is contained in:

committed by
GitHub

parent
5116305f77
commit
2a174b2543
14
.pre-commit-config.yaml
Normal file
14
.pre-commit-config.yaml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/psf/black-pre-commit-mirror
|
||||||
|
rev: 24.3.0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
language_version: python3.11
|
||||||
|
- repo: https://github.com/pycqa/isort
|
||||||
|
rev: 5.12.0
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
- repo: https://github.com/pycqa/flake8
|
||||||
|
rev: '6.1.0'
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
@ -70,6 +70,17 @@ An easier way to do so is:
|
|||||||
1. Run `.tox/lint-some-package/bin/black .`
|
1. Run `.tox/lint-some-package/bin/black .`
|
||||||
2. Run `.tox/lint-some-package/bin/isort .`
|
2. Run `.tox/lint-some-package/bin/isort .`
|
||||||
|
|
||||||
|
Or you can call formatting and linting in one command by [pre-commit](https://pre-commit.com/):
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ pre-commit
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also configure it to run lint tools automatically before committing with:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ pre-commit install
|
||||||
|
|
||||||
See
|
See
|
||||||
[`tox.ini`](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/tox.ini)
|
[`tox.ini`](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/tox.ini)
|
||||||
for more detail on available tox commands.
|
for more detail on available tox commands.
|
||||||
|
@ -17,3 +17,5 @@ codespell==2.1.0
|
|||||||
requests==2.31.0
|
requests==2.31.0
|
||||||
ruamel.yaml==0.17.21
|
ruamel.yaml==0.17.21
|
||||||
flaky==3.7.0
|
flaky==3.7.0
|
||||||
|
pre-commit==3.7.0; python_version >= '3.9'
|
||||||
|
pre-commit==3.5.0; python_version < '3.9'
|
||||||
|
Reference in New Issue
Block a user