Skip to content

Commit

Permalink
CONTRIBUTING: introduce pre-commit (open-telemetry#2479)
Browse files Browse the repository at this point in the history
  • Loading branch information
xrmx authored May 2, 2024
1 parent 5116305 commit 2a174b2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ An easier way to do so is:
1. Run `.tox/lint-some-package/bin/black .`
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
[`tox.ini`](https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/tox.ini)
for more detail on available tox commands.
Expand Down
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ codespell==2.1.0
requests==2.31.0
ruamel.yaml==0.17.21
flaky==3.7.0
pre-commit==3.7.0; python_version >= '3.9'
pre-commit==3.5.0; python_version < '3.9'

0 comments on commit 2a174b2

Please sign in to comment.