gifn-apply: switch from black to ruff for source-code formatting
Change-Id: I4cc95eae235e9b6214302c4199088751cb29db60
diff --git a/tools/git-if-needed/pyproject.toml b/tools/git-if-needed/pyproject.toml
index 1b060b7..a259e91 100644
--- a/tools/git-if-needed/pyproject.toml
+++ b/tools/git-if-needed/pyproject.toml
@@ -24,9 +24,6 @@
package-dir = {"" = "python"}
packages = ["gifn_apply"]
-[tool.black]
-line-length = 100
-
[tool.mypy]
strict = true
python_version = "3.8"
diff --git a/tools/git-if-needed/python/gifn_apply/__main__.py b/tools/git-if-needed/python/gifn_apply/__main__.py
index 3a07a08..eae4c87 100644
--- a/tools/git-if-needed/python/gifn_apply/__main__.py
+++ b/tools/git-if-needed/python/gifn_apply/__main__.py
@@ -261,16 +261,13 @@
repos_before: Final = {repo: clone_repo(repo) for repo in repos_needed}
cfg.log.info("Making sure that at least one of the changes has not been applied yet")
- unapplied_before_count: Final = len(
- [
- patch
- for patch in patches
- if all(
- patch.change_id not in rchanges.changes_set
- for rchanges in repos_before.values()
- )
- ]
- )
+ unapplied_before_count: Final = len([
+ patch
+ for patch in patches
+ if all(
+ patch.change_id not in rchanges.changes_set for rchanges in repos_before.values()
+ )
+ ])
if not unapplied_before_count:
sys.exit("All the patches have been applied already")
diff --git a/tools/git-if-needed/tox.ini b/tools/git-if-needed/tox.ini
index ce41c10..6c8ad52 100644
--- a/tools/git-if-needed/tox.ini
+++ b/tools/git-if-needed/tox.ini
@@ -6,7 +6,7 @@
envlist =
ruff
ruff-all
- black
+ format
mypy
unit-tests
functional-cinder
@@ -17,24 +17,24 @@
python/gifn_apply \
python/unit_tests
-[testenv:black]
+[testenv:format]
skip_install = True
tags =
check
deps =
- black >= 23, < 24
+ -r python/requirements/ruff.txt
commands =
- black --check -- {[defs]pyfiles}
+ ruff format --check --config python/config/ruff-base/pyproject.toml --diff -- {[defs]pyfiles}
-[testenv:black-reformat]
+[testenv:reformat]
skip_install = True
tags =
format
manual
deps =
- black >= 23, < 24
+ -r python/requirements/ruff.txt
commands =
- black -- {[defs]pyfiles}
+ ruff format --config python/config/ruff-base/pyproject.toml -- {[defs]pyfiles}
[testenv:mypy]
skip_install = True