Skip to content

Commit cefd555

Browse files
committed
WIP Switch linting and formatting to ruff
1 parent 42f9634 commit cefd555

37 files changed

+75
-102
lines changed

.ci/gen_certs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
def main() -> None:
9-
109
parser = argparse.ArgumentParser(prog="gen_certs")
1110
parser.add_argument(
1211
"-d",

.ci/scripts/collect_changes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import itertools
44
import os
55
import re
6-
import tomllib
76

7+
import tomllib
88
from git import GitCommandError, Repo
99
from packaging.version import parse as parse_version
1010

.ci/scripts/pr_labels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
import re
66
import sys
7-
import tomllib
87
from pathlib import Path
98

9+
import tomllib
1010
from git import Repo
1111

1212

.ci/scripts/validate_commit_message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import re
33
import subprocess
44
import sys
5-
import tomllib
65
from pathlib import Path
76

7+
import tomllib
88
from github import Github
99

1010
with open("pyproject.toml", "rb") as fp:

Makefile

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,28 @@ LANGUAGES=de
33
GLUE_PLUGINS=$(notdir $(wildcard pulp-glue/pulp_glue/*))
44
CLI_PLUGINS=$(notdir $(wildcard pulpcore/cli/*))
55

6+
.PHONY: info
67
info:
78
@echo Pulp glue
89
@echo plugins: $(GLUE_PLUGINS)
910
@echo Pulp CLI
1011
@echo plugins: $(CLI_PLUGINS)
1112

13+
.PHONY: build
1214
build:
1315
cd pulp-glue; pyproject-build -n
1416
pyproject-build -n
1517

16-
black: format
17-
18+
.PHONY: format
1819
format:
19-
isort .
20-
cd pulp-glue; isort .
21-
black .
20+
ruff format
21+
ruff check --fix
2222

23+
.PHONY: lint
2324
lint:
2425
find tests .ci -name '*.sh' -print0 | xargs -0 shellcheck -x
25-
isort -c --diff .
26-
cd pulp-glue; isort -c --diff .
27-
black --diff --check .
28-
flake8
26+
ruff format --check --diff
27+
ruff check --diff
2928
.ci/scripts/check_click_for_mypy.py
3029
MYPYPATH=pulp-glue mypy
3130
cd pulp-glue; mypy
@@ -35,21 +34,27 @@ tests/cli.toml:
3534
cp $@.example $@
3635
@echo "In order to configure the tests to talk to your test server, you might need to edit $@ ."
3736

37+
.PHONY: test
3838
test: | tests/cli.toml
3939
python3 -m pytest -v tests pulp-glue/tests cookiecutter/pulp_filter_extension.py
4040

41+
.PHONY: livetest
4142
livetest: | tests/cli.toml
4243
python3 -m pytest -v tests pulp-glue/tests -m live
4344

45+
.PHONY: unittest
4446
unittest:
4547
python3 -m pytest -v tests pulp-glue/tests cookiecutter/pulp_filter_extension.py -m "not live"
4648

49+
.PHONY: unittest_glue
4750
unittest_glue:
4851
python3 -m pytest -v pulp-glue/tests -m "not live"
4952

53+
.PHONY: docs
5054
docs:
5155
pulp-docs build
5256

57+
.PHONY: servedocs
5358
servedocs:
5459
pulp-docs serve -w CHANGES.md -w pulp-glue/pulp_glue -w pulp_cli/generic.py
5560

@@ -61,6 +66,7 @@ pulpcore/cli/%/locale/messages.pot: pulpcore/cli/%/*.py
6166
xgettext -d $* -o $@ pulpcore/cli/$*/*.py
6267
sed -i 's/charset=CHARSET/charset=UTF-8/g' $@
6368

69+
.PHONY: extract_messages
6470
extract_messages: $(foreach GLUE_PLUGIN,$(GLUE_PLUGINS),pulp-glue/pulp_glue/$(GLUE_PLUGIN)/locale/messages.pot) $(foreach CLI_PLUGIN,$(CLI_PLUGINS),pulpcore/cli/$(CLI_PLUGIN)/locale/messages.pot)
6571

6672
$(foreach LANGUAGE,$(LANGUAGES),pulp-glue/pulp_glue/%/locale/$(LANGUAGE)/LC_MESSAGES/messages.po): pulp-glue/pulp_glue/%/locale/messages.pot
@@ -76,6 +82,7 @@ $(foreach LANGUAGE,$(LANGUAGES),pulpcore/cli/%/locale/$(LANGUAGE)/LC_MESSAGES/me
7682
%.mo: %.po
7783
msgfmt -o $@ $<
7884

85+
.PHONY: compile_messages
7986
compile_messages: $(foreach LANGUAGE,$(LANGUAGES),$(foreach GLUE_PLUGIN,$(GLUE_PLUGINS),pulp-glue/pulp_glue/$(GLUE_PLUGIN)/locale/$(LANGUAGE)/LC_MESSAGES/messages.mo)) $(foreach LANGUAGE,$(LANGUAGES),$(foreach CLI_PLUGIN,$(CLI_PLUGINS),pulpcore/cli/$(CLI_PLUGIN)/locale/$(LANGUAGE)/LC_MESSAGES/messages.mo))
80-
.PHONY: build info black lint test docs servedocs
87+
8188
.PRECIOUS: $(foreach LANGUAGE,$(LANGUAGES),$(foreach GLUE_PLUGIN,$(GLUE_PLUGINS),pulp-glue/pulp_glue/$(GLUE_PLUGIN)/locale/$(LANGUAGE)/LC_MESSAGES/messages.po)) $(foreach LANGUAGE,$(LANGUAGES),$(foreach CLI_PLUGIN,$(CLI_PLUGINS),pulpcore/cli/$(CLI_PLUGIN)/locale/$(LANGUAGE)/LC_MESSAGES/messages.po))

cookiecutter/apply_templates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# This script requires click, cookiecutter, tomlkit and pyyaml
44

55
import os
6-
import tomllib
76
from pathlib import Path
87

98
import click
9+
import tomllib
1010
import yaml
1111

1212
from cookiecutter.main import cookiecutter

cookiecutter/ci/hooks/post_gen_project.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# flake8: noqa
2-
31
import os
42
import shutil
53
import sys
@@ -17,6 +15,10 @@
1715
# Is merging on the tool level appropriate?
1816
pyproject_toml["tool"].update(pyproject_toml_update["tool"])
1917

18+
# Remove legacy tools.
19+
for tool in ["flake8", "black", "isort"]:
20+
pyproject_toml["tool"].pop(tool, None)
21+
2022
with open("pyproject.toml", "w") as fp:
2123
tomlkit.dump(pyproject_toml, fp)
2224

cookiecutter/ci/{{ cookiecutter.__project_name }}/.ci/gen_certs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
def main() -> None:
9-
109
parser = argparse.ArgumentParser(prog="gen_certs")
1110
parser.add_argument(
1211
"-d",

cookiecutter/ci/{{ cookiecutter.__project_name }}/.ci/scripts/collect_changes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import itertools
44
import os
55
import re
6-
import tomllib
76

7+
import tomllib
88
from git import GitCommandError, Repo
99
from packaging.version import parse as parse_version
1010

cookiecutter/ci/{{ cookiecutter.__project_name }}/.ci/scripts/pr_labels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
import re
66
import sys
7-
import tomllib
87
from pathlib import Path
98

9+
import tomllib
1010
from git import Repo
1111

1212

0 commit comments

Comments
 (0)