Skip to content

Commit

Permalink
Add ruff configuration and run ruff in pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener authored and andresailer committed Oct 1, 2024
1 parent 990540a commit d90f654
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
source /root/pre-commit-venv/bin/activate
pip install pre-commit
export PYTHONPATH=$VIRTUAL_ENV/lib/python3.$(python3 -c 'import sys; print(f"{sys.version_info[1]}")')/site-packages:$PYTHONPATH
# Newer versions of git are more cautious around the github runner
# environment and without this git rev-parse --show-cdup in pre-commit
# fails
git config --global --add safe.directory $(pwd)
pre-commit run --show-diff-on-failure \
--color=always \
--all-files
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ repos:
rev: v4.5.0
hooks:
- id: check-xml
- repo: local
hooks:
- id: ruff-format
name: ruff-format
entry: ruff format --force-exclude
types: [python]
language: system
10 changes: 10 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
target-version = "py311"

line-length = 99

[format]
# Make things format the same way as black
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

0 comments on commit d90f654

Please sign in to comment.