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

Update pre-commit hooks #118

Merged
merged 10 commits into from
Sep 17, 2023
8 changes: 7 additions & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
cache: pip
nilsnolde marked this conversation as resolved.
Show resolved Hide resolved

- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install dependencies
run: |
pip install -r requirements_dev.txt

- name: style & lint checks
run: |
pre-commit run --all-files
pre-commit run --all-files --color=always

- name: pytest and coverage
run: |
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
repos:
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.9.1
hooks:
- id: black
language_version: python3
# temp exlude osrm: black fails to reformat for some reason
args: [routingpy, tests, --exclude, routingpy/routers/mapbox_osrm.py]
- repo: https://github.com/pycqa/flake8
rev: 5.0.4 # pick a git hash / tag to point to
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.290
hooks:
- id: flake8
- id: ruff
- repo: https://github.com/pycqa/isort
rev: 5.11.5
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
Expand Down
39 changes: 39 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Enable the pycodestyle (`E`) and Pyflakes (`F`) rules by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E", "F"]
ignore = ["E203", "E266", "E501", "F403", "E722", "F405"]

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"__pycache__",
"docs",
"examples",
]
per-file-ignores = {}

line-length = 105

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"