gifn-apply: Ruff preview mode: SPDX, subprocess
Enable Ruff's preview mode.
Specify a regular expression to check for copyright notices that
will match our SPDX tags.
Override another "subprocess is insecure" warning.
Ruff: CPY001,S404
Change-Id: I47e11e6c8269b92e68ea51659a9e790d3ef9315e
diff --git a/tools/git-if-needed/python/config/ruff-base/pyproject.toml b/tools/git-if-needed/python/config/ruff-base/pyproject.toml
index b96c622..b46b792 100644
--- a/tools/git-if-needed/python/config/ruff-base/pyproject.toml
+++ b/tools/git-if-needed/python/config/ruff-base/pyproject.toml
@@ -4,6 +4,7 @@
[tool.ruff]
target-version = "py38"
line-length = 100
+preview = true
select = []
ignore = [
# We know what "self" is, we hope
@@ -26,6 +27,9 @@
"TRY003",
]
+[tool.ruff.flake8-copyright]
+notice-rgx = "(?x) SPDX-FileCopyrightText: \\s \\S"
+
[tool.ruff.per-file-ignores]
# This is a test suite
"*/unit_tests/*" = ["S101"]
diff --git a/tools/git-if-needed/python/gifn_apply/gifn.py b/tools/git-if-needed/python/gifn_apply/gifn.py
index b17cd76..3dbee5e 100644
--- a/tools/git-if-needed/python/gifn_apply/gifn.py
+++ b/tools/git-if-needed/python/gifn_apply/gifn.py
@@ -5,7 +5,7 @@
from __future__ import annotations
import shlex
-import subprocess
+import subprocess # noqa: S404
from typing import TYPE_CHECKING
diff --git a/tools/git-if-needed/python/gifn_apply/git.py b/tools/git-if-needed/python/gifn_apply/git.py
index f19efab..8650fd6 100644
--- a/tools/git-if-needed/python/gifn_apply/git.py
+++ b/tools/git-if-needed/python/gifn_apply/git.py
@@ -4,7 +4,7 @@
from __future__ import annotations
-import subprocess
+import subprocess # noqa: S404
from typing import TYPE_CHECKING