From 3631177635e73513903ee1f59479dba9fa156da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 20 Oct 2024 17:18:16 +0200 Subject: [PATCH] Add basic ruff config --- .pre-commit-config.yaml | 15 +++++---------- tools/copier_update.py | 4 ++-- tools/create_branch.py | 1 + tools/fix_manifest_website.py | 1 + tools/oca_projects.py | 1 + tools/oca_sync_users.py | 1 + tools/odoo_login.py | 2 +- tools/set_repo_labels.py | 1 + 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index db0b4ee96..5df97025c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,15 +1,10 @@ exclude: | (?x) ^template/ -default_language_version: - python: python3 repos: - - repo: https://github.com/PyCQA/flake8 - rev: 3.9.2 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.7.0 hooks: - - id: flake8 - name: flake8 - - repo: https://github.com/psf/black - rev: 22.8.0 - hooks: - - id: black + - id: ruff + args: [--fix] + - id: ruff-format diff --git a/tools/copier_update.py b/tools/copier_update.py index 2c8b62af6..6ca98e6e7 100644 --- a/tools/copier_update.py +++ b/tools/copier_update.py @@ -1,5 +1,5 @@ -"""Run copier update on a branch in all addons repos. -""" +"""Run copier update on a branch in all addons repos.""" + import subprocess import textwrap from pathlib import Path diff --git a/tools/create_branch.py b/tools/create_branch.py index 76b523901..bf501af06 100644 --- a/tools/create_branch.py +++ b/tools/create_branch.py @@ -3,6 +3,7 @@ TODO - load copier answers from a previous branch """ + import subprocess import click diff --git a/tools/fix_manifest_website.py b/tools/fix_manifest_website.py index 46c09a82d..616164956 100644 --- a/tools/fix_manifest_website.py +++ b/tools/fix_manifest_website.py @@ -1,4 +1,5 @@ """Set the website key in addons manifests.""" + import os import re diff --git a/tools/oca_projects.py b/tools/oca_projects.py index 686ebd5d6..7699c48a5 100644 --- a/tools/oca_projects.py +++ b/tools/oca_projects.py @@ -6,6 +6,7 @@ OCA_REPOSITORY_NAMES: list of OCA repository names """ + from __future__ import print_function from contextlib import contextmanager import os diff --git a/tools/oca_sync_users.py b/tools/oca_sync_users.py index 2a759e52c..a789ff50c 100644 --- a/tools/oca_sync_users.py +++ b/tools/oca_sync_users.py @@ -6,6 +6,7 @@ This enables adding them to project teams in the OCA instance. """ + from __future__ import absolute_import, print_function import xmlrpclib diff --git a/tools/odoo_login.py b/tools/odoo_login.py index 00611560c..5fe761ccf 100644 --- a/tools/odoo_login.py +++ b/tools/odoo_login.py @@ -58,7 +58,7 @@ def get_parser(with_help=False): action="store_true", help="Store the username and password in a " "configuration file. Warning, clear text!", - ), + ) return parser diff --git a/tools/set_repo_labels.py b/tools/set_repo_labels.py index 537d27110..1e0abb817 100644 --- a/tools/set_repo_labels.py +++ b/tools/set_repo_labels.py @@ -4,6 +4,7 @@ Create and modify labels on github to have same labels and same color on all repo """ + from __future__ import print_function import click