From 6f331096b2301a411cadc005ef90c893a1e10755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Thu, 2 May 2024 15:02:13 +0200 Subject: [PATCH] Upgrade linters --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 8 +++++--- src/manifestoo_core/git_postversion.py | 6 +++--- src/manifestoo_core/odoo_series.py | 1 + 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b6540d7..1c85656 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,14 +2,14 @@ default_language_version: python: python3 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-toml - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.8 + rev: v0.4.2 hooks: - id: ruff args: [--exit-non-zero-on-fix] diff --git a/pyproject.toml b/pyproject.toml index 5d2501b..d69e457 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,7 +60,10 @@ exclude = [ ] [tool.ruff] +target-version = "py37" fix = true + +[tool.ruff.lint] extend-select = [ "B", # flake8-bugbear "C4", # flake8-comprehensions @@ -78,7 +81,6 @@ extend-select = [ "TRY", "W", ] -target-version = "py37" ignore = [ # "C408", # Unnecessary `dict` call (rewrite as a literal) ] @@ -87,7 +89,7 @@ exclude = [ "mk_core_addons", ] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "tests/*.py" = [ "S101", # use of assert detected "S603", # `subprocess` call: check for execution of untrusted input @@ -95,7 +97,7 @@ exclude = [ ] -[tool.ruff.isort] +[tool.ruff.lint.isort] known-first-party = ["manifestoo_core"] diff --git a/src/manifestoo_core/git_postversion.py b/src/manifestoo_core/git_postversion.py index c61ab03..192504f 100644 --- a/src/manifestoo_core/git_postversion.py +++ b/src/manifestoo_core/git_postversion.py @@ -175,11 +175,11 @@ def get_git_postversion( # noqa: C901, PLR0911, PLR0912 too complex return last_version if last_sha: if strategy == POST_VERSION_STRATEGY_NINETYNINE_DEVN: - return last_version + ".99.dev%s" % count + return last_version + f".99.dev{count}" if strategy == POST_VERSION_STRATEGY_P1_DEVN: - return _bump_last(last_version) + ".dev%s" % count + return _bump_last(last_version) + f".dev{count}" if strategy == POST_VERSION_STRATEGY_DOT_N: - return last_version + ".%s" % count + return last_version + f".{count}" msg = f"Unknown postversion strategy: {strategy}" raise UnknownPostVersionStrategy(msg) if uncommitted: diff --git a/src/manifestoo_core/odoo_series.py b/src/manifestoo_core/odoo_series.py index 2b83a57..f5cfc09 100644 --- a/src/manifestoo_core/odoo_series.py +++ b/src/manifestoo_core/odoo_series.py @@ -1,4 +1,5 @@ """Odoo Series and Editions.""" + from enum import Enum from typing import Optional, Set