Skip to content

Commit

Permalink
chore: use poetry for linter tools installation and bump Ruff from 0.…
Browse files Browse the repository at this point in the history
…4 to 0.5 (#6081)
  • Loading branch information
bowenliang123 authored Jul 9, 2024
1 parent 757ceda commit f9d00e0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
39 changes: 20 additions & 19 deletions api/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,5 @@ pytest-mock = "~3.14.0"
optional = true

[tool.poetry.group.lint.dependencies]
ruff = "~0.4.8"
dotenv-linter = "~0.5.0"
ruff = "~0.5.1"
dotenv-linter = "~0.5.0"
15 changes: 5 additions & 10 deletions dev/reformat
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@

set -x

# python style checks rely on `ruff` in path
if ! command -v ruff &> /dev/null; then
echo "Installing Ruff ..."
pip install ruff
# style checks rely on commands in path
if ! command -v ruff &> /dev/null || ! command -v dotenv-linter &> /dev/null; then
echo "Installing linting tools (Ruff, dotenv-linter ...) ..."
poetry install -C api --only lint
fi

# run ruff linter
ruff check --fix ./api

# env files linting relies on `dotenv-linter` in path
if ! command -v dotenv-linter &> /dev/null; then
echo "Installing dotenv-linter ..."
pip install dotenv-linter
fi

# run dotenv-linter linter
dotenv-linter ./api/.env.example ./web/.env.example
8 changes: 6 additions & 2 deletions web/.husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ if $api_modified; then

# python style checks rely on `ruff` in path
if ! command -v ruff &> /dev/null; then
echo "Installing Ruff ..."
pip install ruff
echo "Installing linting tools (Ruff, dotenv-linter ...) ..."
poetry install -C api --only lint
fi

# run Ruff linter auto-fixing
ruff check --fix ./api

# run Ruff linter checks
ruff check --preview ./api || status=$?

status=${status:-0}
Expand Down

0 comments on commit f9d00e0

Please sign in to comment.