Skip to content

Commit

Permalink
configure ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
rm03 committed Jan 16, 2024
1 parent b5a171b commit f2e5528
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 16 deletions.
20 changes: 6 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,21 @@
repos:
- repo: local
hooks:
- id: black
name: black
entry: bash -c "export PIPENV_IGNORE_VIRTUALENVS=1 && cd backend && pipenv run black ."
- id: ruff-format
name: Ruff Formatter
entry: bash -c "export PIPENV_IGNORE_VIRTUALENVS=1 && cd backend && pipenv run ruff format ."
language: python
types: [python]
require_serial: true
files: ^backend/
pass_filenames: false
- id: isort
name: isort
entry: isort
- id: ruff-lint-fix
name: Ruff Lint (Apply Fixes)
entry: ruff check . --fix
language: python
types: [python]
require_serial: true
files: ^backend/
# - id: flake8
# name: flake8
# entry: flake8
# language: python
# types: [python]
# require_serial: true
# files: ^backend/
# args: [--config, backend/setup.cfg]
- id: frontend
name: Yarn Linter
entry: bash -c "cd frontend && yarn lint"
Expand Down
1 change: 1 addition & 0 deletions backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ isort = "*"
flake8-quotes = "*"
django-debug-toolbar = "*"
django-extensions = "*"
ruff = "*"

[packages]
dj-database-url = "*"
Expand Down
26 changes: 25 additions & 1 deletion backend/Pipfile.lock

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

2 changes: 1 addition & 1 deletion backend/clubs/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

router.register(r"schools", SchoolViewSet, basename="schools")
router.register(r"majors", MajorViewSet, basename="majors")
router.register(r"student_types", StudentTypeViewSet, basename="student_types"),
router.register(r"student_types", StudentTypeViewSet, basename="student_types")
router.register(r"reports", ReportViewSet, basename="reports")
router.register(r"years", YearViewSet, basename="years")
router.register(r"users", UserViewSet, basename="users")
Expand Down
21 changes: 21 additions & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[tool.ruff]
exclude = [
".venv",
"migrations",
]
ignore = ["E203"]
line-length = 88
select = [
"E",
"F",
"Q",
"W",
"I",
]

[tool.ruff.flake8-quotes]
inline-quotes = "double"

[tool.ruff.isort]
known-first-party = ["pennclubs", "clubs"]
lines-after-imports = 2

0 comments on commit f2e5528

Please sign in to comment.