Skip to content

Commit

Permalink
🔨 Update check and format scripts and use in pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
waketzheng committed Oct 17, 2024
1 parent d9828aa commit c4e8992
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
13 changes: 5 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: [email protected]:astral-sh/ruff-pre-commit
# https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.2 # Ruff version.
- repo: local
hooks:
# Run the linter.
- id: ruff
args: [ --fix, --extend-select=I ]
# Run the formatter.
- id: ruff-format
- id: check
name: check by ruff/mypy
entry: ./scripts/check.sh
language: script
2 changes: 1 addition & 1 deletion scripts/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
set -x

[ -f ../pyproject.toml ] && cd ..
ruff check --extend-select=I .
ruff check --extend-select=I,B,SIM .
ruff format --check .
mypy .
bandit -r fastapi_cdn_host
Expand Down
2 changes: 1 addition & 1 deletion scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -x

[ -f ../pyproject.toml ] && cd ..
ruff format fastapi_cdn_host examples
ruff check --fix fastapi_cdn_host examples
ruff check --fix --extend-select=I,B,SIM fastapi_cdn_host examples

0 comments on commit c4e8992

Please sign in to comment.