Skip to content

Commit

Permalink
Run lefthook for code fmt (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
No767 authored Oct 20, 2024
1 parent f794bbd commit 7e8bf7e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
22 changes: 22 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
pre-commit:
commands:
black-fmt:
root: server/
glob: "*.py"
staged_files: true

run: black {staged_files}

autoflake-fmt:
root: server/
glob: "*.py"
staged_files: true

run: autoflake --in-place --remove-unused-variables {staged_files}

ruff-check:
root: server/
glob: "*.py"
staged_files: true

run: ruff check {staged_files} --fix --exit-non-zero-on-fix --config pyproject.toml
2 changes: 1 addition & 1 deletion server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extend-exclude = ["**/__pycache__"]

[tool.ruff.lint]
ignore = ["E501", "N999", "E402", "S101"]
select = ["E", "F", "N", "ASYNC", "S", "ERA"]
select = ["E", "F", "N", "ASYNC", "S", "ERA", I]

[tool.ruff.lint.isort]
combine-as-imports = true
Expand Down
7 changes: 6 additions & 1 deletion server/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
-r requirements.txt

lefthook>=1.7.22,<2
pyright>=1.1.363,<2
ruff>=0.4.4,<1
tox>=4.15.0,<5
tox>=4.15.0,<5

# Formatters
black>=24.10.0,<25
autoflake>=2.3.1,<3

0 comments on commit 7e8bf7e

Please sign in to comment.