Skip to content

Commit

Permalink
Update pre-commit hooks (#118)
Browse files Browse the repository at this point in the history
Co-authored-by: Nils <nilsnolde@proton.me>
  • Loading branch information
sadikkuzu and nilsnolde committed Sep 17, 2023
1 parent 53dfbeb commit e5eb103
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci-tests.yml
Expand Up @@ -35,14 +35,20 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
cache: pip

- 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
@@ -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
41 changes: 41 additions & 0 deletions pyproject.toml
Expand Up @@ -66,3 +66,44 @@ skip = [
"build",
"dist",
]

[tool.ruff]
# 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]+?))$"

0 comments on commit e5eb103

Please sign in to comment.