From 276209c65a474c78dec1753905251ef49d0d01cb Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Wed, 22 Apr 2026 14:57:46 +0200 Subject: [PATCH] Fix linting `ruff check --diff` implies `--fix-only` and therefor ignores some rules. --- .github/workflows/lint.yml | 4 ++-- plugin-template | 1 + templates/ci/Makefile.j2 | 2 +- templates/github/.github/workflows/lint.yml.j2 | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ea696248..0a9eb53d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -32,7 +32,7 @@ jobs: run: | pip3 install ruff ruff format --check --diff plugin-template utils.py - ruff check --diff plugin-template utils.py + ruff check plugin-template utils.py - name: "Bootstrap catdog plugin" working-directory: "plugin_template" run: | @@ -54,7 +54,7 @@ jobs: - name: "Lint code" run: | - ruff check --diff + ruff check - name: "Check for common gettext problems" run: | diff --git a/plugin-template b/plugin-template index f016491b..902d78b0 100755 --- a/plugin-template +++ b/plugin-template @@ -511,6 +511,7 @@ def remove_deprecated_files(plugin_root_dir: Path, sections: list[str]) -> None: def reformat_files(plugin_root_dir: Path, config: dict[str, t.Any]) -> None: try: subprocess.run(["ruff", "format"], cwd=plugin_root_dir) + subprocess.run(["ruff", "check", "--select", "I", "--fix"], cwd=plugin_root_dir) except FileNotFoundError: pass diff --git a/templates/ci/Makefile.j2 b/templates/ci/Makefile.j2 index 7b0cdce2..36d8739d 100644 --- a/templates/ci/Makefile.j2 +++ b/templates/ci/Makefile.j2 @@ -9,7 +9,7 @@ lint: yamllint -s -d '{extends: relaxed, rules: {line-length: disable}}' .github/workflows bump-my-version bump --dry-run release ruff format --check --diff - ruff check --diff + ruff check {%- if check_manifest %} check-manifest {%- endif %} diff --git a/templates/github/.github/workflows/lint.yml.j2 b/templates/github/.github/workflows/lint.yml.j2 index dfc3e68d..1bc743b4 100644 --- a/templates/github/.github/workflows/lint.yml.j2 +++ b/templates/github/.github/workflows/lint.yml.j2 @@ -34,7 +34,7 @@ jobs: - name: "Lint code" run: | - ruff check --diff + ruff check {%- if check_gettext %} - name: "Check for common gettext problems"