mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-25 11:16:43 +02:00
feat(dev): use ruff for python linting (#355)
This commit is contained in:
5
.github/workflows/pr-python-checks.yml
vendored
5
.github/workflows/pr-python-checks.yml
vendored
@@ -30,6 +30,11 @@ jobs:
|
||||
cd backend
|
||||
mypy .
|
||||
|
||||
- name: Run ruff
|
||||
run: |
|
||||
cd backend
|
||||
ruff .
|
||||
|
||||
- name: Check import order with reorder-python-imports
|
||||
run: |
|
||||
cd backend
|
||||
|
@@ -23,6 +23,12 @@ repos:
|
||||
- id: autoflake
|
||||
args: [ '--remove-all-unused-imports', '--remove-unused-variables', '--in-place' , '--recursive']
|
||||
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: v0.0.286
|
||||
hooks:
|
||||
- id: ruff
|
||||
|
||||
# We would like to have a mypy pre-commit hook, but due to the fact that
|
||||
# pre-commit runs in it's own isolated environment, we would need to install
|
||||
# and keep in sync all dependencies so mypy has access to the appropriate type
|
||||
|
14
backend/pyproject.toml
Normal file
14
backend/pyproject.toml
Normal file
@@ -0,0 +1,14 @@
|
||||
[tool.mypy]
|
||||
plugins = "sqlalchemy.ext.mypy.plugin"
|
||||
mypy_path = "$MYPY_CONFIG_FILE_DIR"
|
||||
explicit_package_bases = true
|
||||
disallow_untyped_defs = true
|
||||
|
||||
[tool.ruff]
|
||||
ignore = []
|
||||
line-length = 130
|
||||
select = [
|
||||
"E",
|
||||
"F",
|
||||
"W",
|
||||
]
|
@@ -3,6 +3,7 @@ mypy-extensions==1.0.0
|
||||
mypy==1.1.1
|
||||
pre-commit==3.2.2
|
||||
reorder-python-imports==3.9.0
|
||||
ruff==0.0.286
|
||||
types-beautifulsoup4==4.12.0.3
|
||||
types-html5lib==1.1.11.13
|
||||
types-oauthlib==3.2.0.9
|
||||
|
@@ -1,8 +0,0 @@
|
||||
[mypy]
|
||||
plugins = sqlalchemy.ext.mypy.plugin
|
||||
mypy_path = $MYPY_CONFIG_FILE_DIR
|
||||
explicit_package_bases = True
|
||||
disallow_untyped_defs = True
|
||||
|
||||
[flake8]
|
||||
max-line-length = 88
|
Reference in New Issue
Block a user