Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run lint with pre-commit #1546

Merged
merged 7 commits into from
Aug 22, 2022
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
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.8.0
hooks:
- id: isort

- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args:
[
"-rn",
"-j0",
"--rcfile=.pylintrc",
]
exclude: ^(docs/|changelog.py)
require_serial: true
9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,10 @@ tox-env-clean:
rm -rf .tox

lint: check-venv
@. $(VENV_ACTIVATE_FILE); find esrally benchmarks scripts tests it -name "*.py" -exec pylint -j0 -rn --rcfile=$(CURDIR)/.pylintrc \{\} +
@. $(VENV_ACTIVATE_FILE); black --check --diff .
@. $(VENV_ACTIVATE_FILE); isort --check --diff .
@. $(VENV_ACTIVATE_FILE); pre-commit run --all-files

format: check-venv
@. $(VENV_ACTIVATE_FILE); black .
@. $(VENV_ACTIVATE_FILE); isort .
# pre-commit run also formats files, but let's keep `make format` for convenience
format: lint

docs: check-venv
@. $(VENV_ACTIVATE_FILE); cd docs && $(MAKE) html
Expand Down
2 changes: 2 additions & 0 deletions docs/developing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Rally uses automatic code formatters. They're enforced by ``make lint`` and you

However, consider using editor integrations to do it automatically: you'll need to configure `black <https://black.readthedocs.io/en/stable/integrations/editors.html>`_ and `isort <https://github.com/PyCQA/isort/wiki/isort-Plugins>`_.

Also consider running `pre-commit install` to run lint as part of your git commits.

Automatic Updates
~~~~~~~~~~~~~~~~~

Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ develop = [
"twine==1.15.0",
"wheel==0.37.1",
"github3.py==1.3.0",
"pre-commit==2.20.0",
"pylint==2.6.0",
"black==22.3.0",
"isort==5.8.0",
"trustme==0.9.0",
"pytest-httpserver==1.0.4",
]
Expand Down