Tweak ruff config and update pre-commit hooks

This commit is contained in:
Stéphane Bidoul 2023-02-22 22:55:30 +01:00
parent 479607e34c
commit 3c54a393ba
5 changed files with 20 additions and 19 deletions

View file

@ -2,7 +2,7 @@ default_language_version:
python: python3 python: python3
repos: repos:
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 22.10.0 rev: 23.1.0
hooks: hooks:
- id: black - id: black
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
@ -13,6 +13,6 @@ repos:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit - repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.149 rev: v0.0.252
hooks: hooks:
- id: ruff - id: ruff

View file

@ -39,17 +39,18 @@ mypy = [
Home = "https://github.com/sbidoul/runboat" Home = "https://github.com/sbidoul/runboat"
[tool.ruff] [tool.ruff]
fix = false fix = true
target-version = "py310"
select = [ select = [
"E", "F", "U", "N", "S", "C", "B", "A", "I", "T", "Q", "YTT", "BLE", "C", "RUF", "M" "F", # pyflakes
] "E", # pycodestyle
ignore = [ "W", # pycodestyle
"B008", "C90", # mccabe
"BLE001", "I", # isort
"N805", "UP", # pyupgrade
"N818", "T10", # flake8-debugger
"S101", "PLE", # pylint errors
"U007", "RUF",
] ]
[tool.ruff.mccabe] [tool.ruff.mccabe]

View file

@ -1,7 +1,7 @@
import asyncio import asyncio
import logging import logging
from collections.abc import Awaitable from collections.abc import Awaitable, Callable
from typing import Any, Callable from typing import Any
from . import k8s from . import k8s
from .db import BuildsDb from .db import BuildsDb

View file

@ -4,12 +4,12 @@ import os
import shutil import shutil
import subprocess import subprocess
import tempfile import tempfile
from collections.abc import Generator from collections.abc import Callable, Generator
from contextlib import contextmanager from contextlib import contextmanager
from enum import Enum from enum import Enum
from importlib import resources from importlib import resources
from pathlib import Path from pathlib import Path
from typing import Any, Callable, TypedDict, cast from typing import Any, TypedDict, cast
import urllib3 import urllib3
from jinja2 import Template from jinja2 import Template
@ -212,7 +212,7 @@ async def _kubectl(args: list[str]) -> None:
) )
return_code = await proc.wait() return_code = await proc.wait()
if return_code != 0: if return_code != 0:
raise subprocess.CalledProcessError(return_code, ["kubectl"] + args) raise subprocess.CalledProcessError(return_code, ["kubectl", *args])
async def deploy(kubefiles_path: Path | None, deployment_vars: DeploymentVars) -> None: async def deploy(kubefiles_path: Path | None, deployment_vars: DeploymentVars) -> None:

View file

@ -1,10 +1,10 @@
import asyncio import asyncio
import functools import functools
import re import re
from collections.abc import AsyncGenerator, Awaitable, Generator, Iterator from collections.abc import AsyncGenerator, Awaitable, Callable, Generator, Iterator
from concurrent.futures.thread import ThreadPoolExecutor from concurrent.futures.thread import ThreadPoolExecutor
from functools import wraps from functools import wraps
from typing import Any, Callable, ParamSpec, TypeVar from typing import Any, ParamSpec, TypeVar
_pool = ThreadPoolExecutor(max_workers=20, thread_name_prefix="sync_to_async") _pool = ThreadPoolExecutor(max_workers=20, thread_name_prefix="sync_to_async")