Use ruff for linting

This commit is contained in:
Stéphane Bidoul 2022-11-20 21:01:58 +01:00
parent 02a29d895b
commit 4d81c758c8
4 changed files with 23 additions and 35 deletions

View file

@ -1,5 +0,0 @@
[flake8]
max-line-length = 88
; E203 for black
; B008 does not like fastapi Depends
extend-ignore = E203,B008

View file

@ -5,15 +5,6 @@ repos:
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/PyCQA/autoflake
rev: v1.7.6
hooks:
- id: autoflake
args:
- --in-place
- --ignore-init-module-imports
- --remove-all-unused-imports
- --remove-duplicate-keys
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
@ -21,22 +12,7 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/PyCQA/flake8
rev: "5.0.4"
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.128
hooks:
- id: flake8
additional_dependencies: ["flake8-bugbear==22.9.11"]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/PyCQA/docformatter
rev: v1.5.0
hooks:
- id: docformatter
args: ["--in-place", "--wrap-summaries=88"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.1.0
hooks:
- id: pyupgrade
args: ["--py39-plus"]
- id: ruff

View file

@ -38,8 +38,25 @@ mypy = [
[project.urls]
Home = "https://github.com/sbidoul/runboat"
[tool.isort]
profile = 'black'
[tool.ruff]
fix = false
select = [
"E", "F", "U", "N", "S", "C", "B", "A", "I", "T", "Q", "YTT", "BLE", "C", "RUF", "M"
]
ignore = [
"B008",
"BLE001",
"N805",
"N818",
"S101",
"U007",
]
[tool.ruff.mccabe]
max-complexity = 15
[tool.ruff.isort]
known-first-party = ["runboat"]
[tool.pytest.ini_options]
env_override_existing_values = 1

View file

@ -181,7 +181,7 @@ class Build(BaseModel):
async def _deploy(
cls, commit_info: CommitInfo, name: str, slug: str, job_kind: k8s.DeploymentMode
) -> None:
"""Internal method to prepare for and handle a k8s.deploy()"""
"""Internal method to prepare for and handle a k8s.deploy()."""
build_settings = settings.get_build_settings(
commit_info.repo, commit_info.target_branch
)[0]