Merge pull request #88 from sbidoul/ruff

Use ruff for linting
This commit is contained in:
Stéphane Bidoul 2022-11-20 21:13:07 +01:00 committed by GitHub
commit b111e81e26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 rev: 22.10.0
hooks: hooks:
- id: black - 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 - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0 rev: v4.3.0
hooks: hooks:
@ -21,22 +12,7 @@ repos:
- id: check-yaml - id: check-yaml
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/PyCQA/flake8 - repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "5.0.4" rev: v0.0.128
hooks: hooks:
- id: flake8 - id: ruff
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"]

View file

@ -38,8 +38,25 @@ mypy = [
[project.urls] [project.urls]
Home = "https://github.com/sbidoul/runboat" Home = "https://github.com/sbidoul/runboat"
[tool.isort] [tool.ruff]
profile = 'black' 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] [tool.pytest.ini_options]
env_override_existing_values = 1 env_override_existing_values = 1

View file

@ -181,7 +181,7 @@ class Build(BaseModel):
async def _deploy( async def _deploy(
cls, commit_info: CommitInfo, name: str, slug: str, job_kind: k8s.DeploymentMode cls, commit_info: CommitInfo, name: str, slug: str, job_kind: k8s.DeploymentMode
) -> None: ) -> 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( build_settings = settings.get_build_settings(
commit_info.repo, commit_info.target_branch commit_info.repo, commit_info.target_branch
)[0] )[0]