Skip to content

Commit

Permalink
Add ruff for formatting and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcUsher committed Nov 14, 2024
1 parent 1609117 commit 4f83e94
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 23 deletions.
24 changes: 9 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
repos:
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies: [Flake8-pyproject]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-ast
- repo: https://github.com/pycqa/isort
rev: 5.13.2
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version. If bumping this, please also bump requirements-dev.in
rev: v0.6.7
hooks:
- id: isort
name: isort (python)
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
Expand Down
29 changes: 21 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,29 @@ dependencies = [
"prance>=23.6.21.0",
]

[tool.black]
[tool.ruff]
line-length = 120

[tool.flake8]
max-line-length = 120
ignore = ['E203', 'W503']
count = true
target-version = "py310"

[tool.isort]
profile = "black"
force_single_line = "true"
[tool.ruff.lint]
select = [
"E", # pycodestyle
"W", # pycodestyle
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C90", # mccabe cyclomatic complexity
"G", # flake8-logging-format
]
ignore = []
exclude = [
"db/migrations/versions/",
"venv*",
".venv*",
"__pycache__",
]
mccabe.max-complexity = 12

[tool.uv]

Expand All @@ -37,4 +49,5 @@ dev = [
"pytest-env>=1.1.3",
"pytest-flask>=1.3.0",
"pytest-mock==3.14.0",
"ruff>=0.7.3",
]
27 changes: 27 additions & 0 deletions uv.lock

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

0 comments on commit 4f83e94

Please sign in to comment.