From 35e0432103db67b291fcc062bab15145727fe396 Mon Sep 17 00:00:00 2001 From: C-Achard Date: Thu, 19 Feb 2026 18:05:02 +0100 Subject: [PATCH] Update pre-commit hooks and ruff config Add and reorganize pre-commit hooks: include check-added-large-files, check-yaml, check-toml, name-tests-test (with --pytest-test-first), check-merge-conflict; replace setup-cfg-fmt with pyproject-fmt and add validate-pyproject. Bump astral-sh/ruff-pre-commit to v0.15.0. Uncomment and enable Ruff configuration in pyproject.toml (lint rules, fix, target-version, line-length, pydocstyle convention) and add [tool.pyproject-fmt] settings (max_supported_python=3.12, generate_python_version_classifiers=true, table_format="long") to control pyproject formatting behavior. --- .pre-commit-config.yaml | 21 +++++++++++++++------ pyproject.toml | 24 +++++++++++++++--------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2e5ed7b..7e74fb5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,18 +2,27 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - - id: check-docstring-first + - id: check-added-large-files + - id: check-yaml + - id: check-toml - id: end-of-file-fixer + - id: name-tests-test + args: [--pytest-test-first] - id: trailing-whitespace - - repo: https://github.com/asottile/setup-cfg-fmt - rev: v3.2.0 + - id: check-merge-conflict + - repo: https://github.com/tox-dev/pyproject-fmt + rev: v2.15.2 hooks: - - id: setup-cfg-fmt + - id: pyproject-fmt + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.25 + hooks: + - id: validate-pyproject - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.10 + rev: v0.15.0 hooks: # Run the formatter. - id: ruff-format # Run the linter. - id: ruff-check - args: [--fix,--unsafe-fixes] + args: [--fix,--unsafe-fixes] \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 430c0b2..1762f25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,12 +95,18 @@ dlclive = [ "modelzoo/project_configs/*.yaml", ] -# [tool.ruff] -# lint.select = ["E", "F", "B", "I", "UP"] -# lint.ignore = ["E741"] -# target-version = "py310" -# fix = true -# line-length = 120 - -# [tool.ruff.lint.pydocstyle] -# convention = "google" +[tool.ruff] +lint.select = ["E", "F", "B", "I", "UP"] +lint.ignore = ["E741"] +target-version = "py310" +fix = true +line-length = 120 + +[tool.ruff.lint.pydocstyle] +convention = "google" + +[tool.pyproject-fmt] +max_supported_python = "3.12" +generate_python_version_classifiers = true +# Avoid collapsing tables to field.key = value format (less readable) +table_format = "long" \ No newline at end of file