Skip to content

Commit

Permalink
dev: Use Ruff instead of Black/isort/pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlesne committed Sep 5, 2024
1 parent 9958da6 commit b47504f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 176 deletions.
5 changes: 1 addition & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
"recommendations": [
"bierner.markdown-mermaid",
"bradlc.vscode-tailwindcss",
"charliermarsh.ruff",
"DavidAnson.vscode-markdownlint",
"EditorConfig.EditorConfig",
"github.vscode-github-actions",
"mechatroner.rainbow-csv",
"mikestead.dotenv",
"ms-azuretools.vscode-azurefunctions",
"ms-azuretools.vscode-bicep",
"ms-python.black-formatter",
"ms-python.debugpy",
"ms-python.isort",
"ms-python.pylint",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter",
Expand Down
12 changes: 6 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"python.analysis.autoImportCompletions": true,
"python.analysis.typeCheckingMode": "standard",
"python.languageServer": "Pylance",
"python.analysis.typeCheckingMode": "basic",
"ruff.nativeServer": "on",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
},
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
}
},
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint",
Expand Down
21 changes: 6 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,8 @@ upgrade:
az bicep upgrade

test:
@echo "➡️ Test generic formatter (Black)..."
python3 -m black --check .

@echo "➡️ Test import formatter (isort)..."
python3 -m isort --jobs -1 --check .

@echo "➡️ Test dependencies issues (deptry)..."
python3 -m deptry .

@echo "➡️ Test code smells (Pylint)..."
python3 -m pylint .
@echo "➡️ Test code smells (Ruff)..."
python3 -m ruff check --select I,PL,RUF,UP,ASYNC,A,DTZ,T20,ARG,PERF --ignore RUF012

@echo "➡️ Test types (Pyright)..."
python3 -m pyright .
Expand All @@ -101,11 +92,11 @@ test:
tests/*.py

lint:
@echo "➡️ Fix with generic formatter (Black)..."
python3 -m black .
@echo "➡️ Fix with formatter..."
python3 -m ruff format

@echo "➡️ Fix with import formatter (isort)..."
python3 -m isort --jobs -1 .
@echo "➡️ Lint with linter..."
python3 -m ruff check --select I,PL,RUF,UP,ASYNC,A,DTZ,T20,ARG,PERF --ignore RUF012 --fix

tunnel:
@echo "➡️ Creating tunnel..."
Expand Down
29 changes: 7 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,16 @@ dependencies = [

[project.optional-dependencies]
dev = [
"black[jupyter]==24.4.2", # Code formatter
"deepeval==0.21.59", # LLM model evaluation
"deptry==0.16.1", # Dependency tree testing
"isort==5.13.2", # Import sorter
"pip-tools==7.4.1", # Compile requirements.txt from pyproject.toml
"pylint==3.2.5", # Linter
"pyright==1.1.371", # Static type checker
"pytest-assume==2.4.3", # Pytest plugin for conditional tests
"pytest-asyncio==0.23.7", # Pytest plugin for async tests
"pytest-repeat==0.9.3", # Pytest plugin for repeating tests
"pytest-xdist[psutil]==3.6.1", # Pytest plugin for parallel testing
"pytest==8.2.2", # Testing framework
"ruff==0.6.2", # Linter
]

[tool.setuptools]
Expand All @@ -81,27 +79,14 @@ DEP002 = [
"aiodns", # Resolver is required for the AIOHTTP AsyncResolver TCP resolver
]

[tool.black]
target-version = ["py311"]
[tool.ruff]
target-version = "py311"

[tool.isort]
combine_as_imports = true
profile = "black"
skip_gitignore = true
[tool.ruff.lint.isort]
combine-as-imports = true

[tool.pylint.MAIN]
fail-under = 8.0
ignore-paths = [
".python_packages/.+", # Azure Functions local build
".venv/.+", # Python virtual environment
]
init-hook='import sys; sys.path.append(".")'
jobs = 0
py-version = "3.11"
recursive = true

[tool.pylint.format]
max-line-length = "88"
[tool.ruff.format]
docstring-code-format = true

[tool.pyright]
pythonVersion = "3.11"
Loading

0 comments on commit b47504f

Please sign in to comment.