From 5fada031b4d946f7d35d8ef5cf7640ad96ff5877 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Tue, 28 Oct 2025 06:18:58 +0100 Subject: [PATCH] Add ruff check to CI. --- antsibull-nox.toml | 2 ++ ruff.toml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 ruff.toml diff --git a/antsibull-nox.toml b/antsibull-nox.toml index 36fd080e..9fb3f3ba 100644 --- a/antsibull-nox.toml +++ b/antsibull-nox.toml @@ -19,6 +19,8 @@ stable_branches = [ "stable-*" ] run_isort = true isort_config = ".isort.cfg" run_black = true +run_ruff_check = true +ruff_check_config = "ruff.toml" run_flake8 = true flake8_config = ".flake8" run_pylint = true diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 00000000..dca70302 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,31 @@ +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later +# SPDX-FileCopyrightText: 2025 Felix Fontein + +line-length = 160 + +[lint] +# https://docs.astral.sh/ruff/rules/ + +select = ["A", "B", "E", "F", "FA", "FLY", "UP", "SIM"] +ignore = [ + # Better keep ignored (for now) + "F811", # Redefinition of unused `xxx` (happens a lot for fixtures in unit tests) + "E402", # Module level import not at top of file + "E741", # Ambiguous variable name + "UP012", # unnecessary-encode-utf8 + "UP015", # Unnecessary mode argument + "SIM105", # suppressible-exception + "SIM108", # if-else-block-instead-of-if-exp + # To fix later: + "B905", # zip-without-explicit-strict - needs Python 3.10+ + # To fix: + "UP024", # Replace aliased errors with `OSError` +] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed or starting with dummy +dummy-variable-rgx = "^(_|dummy).*$"