Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce ruff #363

Merged
merged 77 commits into from
Oct 9, 2023
Merged
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
6df20ce
ci: introduce ruff
sujuka99 Sep 26, 2023
b94737f
ci: exclude snapshots
sujuka99 Sep 26, 2023
0833e1b
ci(ruff): ignore F401 in tests/*/__init__.py
sujuka99 Sep 26, 2023
a4c92a7
ci(ruff): fix order
sujuka99 Sep 26, 2023
c8bd70c
ci(ruff): comment out rules in nursery, remove comment
sujuka99 Sep 26, 2023
c7bb733
ci(ruff): Autofix "D"
sujuka99 Sep 26, 2023
6379c78
ci(ruff): improve comments
sujuka99 Sep 26, 2023
c70873c
ci(ruff-pydocstyle): improve rule selection
sujuka99 Sep 26, 2023
738e21b
ci(ruff): autofix "D"
sujuka99 Sep 26, 2023
11a54a5
chore: fix docstrings flagged by "D"
sujuka99 Sep 26, 2023
53ba27d
ci(ruff-pyupgrade): autofix
sujuka99 Sep 26, 2023
d090ff0
chore: manually fix code flagged by "UP"
sujuka99 Sep 26, 2023
feb6df3
chore: update snapshots
sujuka99 Sep 26, 2023
cc06875
ci(ruff): add rule ignores for "B"
sujuka99 Sep 26, 2023
687f37d
ci(ruff): configure "B"
sujuka99 Sep 26, 2023
1b6e29c
chore: manually fix code flagged by "B"
sujuka99 Sep 26, 2023
1621db1
chore: fix code flagged by "INP"
sujuka99 Sep 26, 2023
d0eefab
chore(ruff): fix code flagged by "BLE"
sujuka99 Sep 26, 2023
301284e
ci(ruff-commas): autofix
sujuka99 Sep 26, 2023
c7b3251
chore(ruff-comprehensions): ignore "C408"
sujuka99 Sep 26, 2023
0c2c7c1
ci(ruff-errmsg): autofix "EM"
sujuka99 Sep 26, 2023
0160c08
ci(ruff-pie): autofix
sujuka99 Sep 26, 2023
dd29e3a
ci(ruff-pie): exclude "PIE804"
sujuka99 Sep 26, 2023
49e9e4a
ci(ruff-pytest): autofix "PT"
sujuka99 Sep 26, 2023
b93c3d8
chore(ruff-pytest): manually fix code flagged by "PT"
sujuka99 Sep 26, 2023
9a8678a
ci(ruff-raise): autofix "RSE"
sujuka99 Sep 26, 2023
f90dd22
ci(ruff-return): autofix "RET"
sujuka99 Sep 26, 2023
68b824b
ci(ruff-simplify): autofix "SIM"
sujuka99 Sep 26, 2023
57fd749
ci(ruff-type-checking): disable "TCH" temporarily
sujuka99 Sep 26, 2023
57d9b50
ci(ruff): remove "ARG"
sujuka99 Sep 26, 2023
4e2dd33
ci(ruff-pathlib): autofix "PTH"
sujuka99 Sep 26, 2023
2d8129e
chore(ruff-pathlib): manually fix code flagged by "PTH"
sujuka99 Sep 26, 2023
07bf0f4
chore(ruff-pygrep): manually fix code flagged by "PGH"
sujuka99 Sep 26, 2023
8664342
ci(ruff-pylint): autofix "PL"
sujuka99 Sep 26, 2023
0d65ea8
ci(ruff): ignore "PLW2901"
sujuka99 Sep 26, 2023
54d4b4e
chore(ruff-pylint): manually fix code flagged by "PL"
sujuka99 Sep 26, 2023
8be0263
ci(ruff-tryceratops): autofix "TRY"
sujuka99 Sep 26, 2023
e73f9ab
chore(ruff-tryceratops): manually fix code flagged by "TRY"
sujuka99 Sep 26, 2023
794c60d
chore(pre-commit): pass pre-commit checks
sujuka99 Sep 26, 2023
d3d430d
Merge remote-tracking branch 'origin/main' into ci/introduce-ruff
sujuka99 Sep 26, 2023
14c3c99
chore: lint
sujuka99 Sep 26, 2023
c272a06
ci(ruff): enable "TCH" partly
sujuka99 Sep 26, 2023
750555f
ci(ruff): enable "TCH002"
sujuka99 Sep 26, 2023
502574b
ci(ruff): configure
sujuka99 Sep 26, 2023
31cd2be
chore: remove leftover file
sujuka99 Sep 26, 2023
9d4a761
ci: update workflow
sujuka99 Sep 26, 2023
25b0c08
chore: pass tests
sujuka99 Sep 26, 2023
0b9f26c
ci(ruff-type-checking): Add "TCH001" with proper config
sujuka99 Sep 27, 2023
bdee94d
style: one-liner
sujuka99 Sep 27, 2023
847d4e9
ci(ruff): Ignore COM812
sujuka99 Sep 27, 2023
5a6c3d1
Revert "ci(ruff-commas): autofix"
sujuka99 Sep 27, 2023
1e03e1a
test: whether matcher works
sujuka99 Sep 27, 2023
2fab625
test: problem checker
sujuka99 Sep 27, 2023
e3b7122
fix: ci
sujuka99 Sep 27, 2023
884445f
ci(ruff): format output as "text" in the CI only
sujuka99 Sep 27, 2023
0eb104d
fix(ruff): pre-commit wrong arg
sujuka99 Sep 27, 2023
47b3377
fix: ruff args in pre-commit
sujuka99 Sep 27, 2023
60a500b
fix(ci): ruff pre-commit hook
sujuka99 Sep 27, 2023
571c43f
ci: attempt to fix
sujuka99 Sep 27, 2023
3283ec0
fix: problem matcher regex
sujuka99 Sep 27, 2023
6622b59
fix: regex problem matchr
sujuka99 Sep 27, 2023
797aec7
ci: only lint once with ruff
sujuka99 Sep 27, 2023
fcfbcaf
chore: lint ci
sujuka99 Sep 27, 2023
049a3db
fix(ci): deduplicate pre-commit run
sujuka99 Sep 27, 2023
5229ff1
ci: always run ruff
sujuka99 Sep 27, 2023
ed8b99d
fix(ci): windows
sujuka99 Sep 27, 2023
4a82df1
chore: lint and format
sujuka99 Sep 27, 2023
966dd85
docs: add ruff badge
sujuka99 Sep 27, 2023
2712048
ci(ruff): configure isort
sujuka99 Sep 28, 2023
22409bf
chore(ruff): remove comment
sujuka99 Sep 28, 2023
b255ea3
tests: rewrite snapshots
sujuka99 Oct 2, 2023
2b6ac1b
ci: better access to python version
sujuka99 Oct 2, 2023
d1aeac5
ci: remove ruff-ci pre-commit hook
sujuka99 Oct 2, 2023
c56ef96
ci: remove repeating repo definitions pre-commit
sujuka99 Oct 2, 2023
a2c5a7f
chore: typing
sujuka99 Oct 2, 2023
1d7a04b
ci: update ruff
sujuka99 Oct 2, 2023
5aa5936
ci: remove future import that breaks ruff
sujuka99 Oct 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ci(ruff-simplify): autofix "SIM"
sujuka99 committed Sep 26, 2023
commit 68b824b287fcf3bee03bae694077f1f9c1814118
2 changes: 1 addition & 1 deletion kpops/component_handlers/topic/handler.py
Original file line number Diff line number Diff line change
@@ -65,7 +65,7 @@ def create_topics(self, to_section: ToSection, dry_run: bool) -> None:
self.proxy_wrapper.create_topic(topic_spec=topic_spec)

def delete_topics(self, to_section: ToSection, dry_run: bool) -> None:
for topic_name in to_section.topics.keys():
for topic_name in to_section.topics:
if dry_run:
self.__dry_run_topic_deletion(topic_name=topic_name)
else:
36 changes: 18 additions & 18 deletions tests/compiler/test_pipeline_name.py
Original file line number Diff line number Diff line change
@@ -14,39 +14,39 @@
def test_should_set_pipeline_name_with_default_base_dir():
Pipeline.set_pipeline_name_env_vars(DEFAULT_BASE_DIR, PIPELINE_PATH)

assert "some-random-path-for-testing" == ENV["pipeline_name"]
assert "some" == ENV["pipeline_name_0"]
assert "random" == ENV["pipeline_name_1"]
assert "path" == ENV["pipeline_name_2"]
assert "for" == ENV["pipeline_name_3"]
assert "testing" == ENV["pipeline_name_4"]
assert ENV["pipeline_name"] == "some-random-path-for-testing"
assert ENV["pipeline_name_0"] == "some"
assert ENV["pipeline_name_1"] == "random"
assert ENV["pipeline_name_2"] == "path"
assert ENV["pipeline_name_3"] == "for"
assert ENV["pipeline_name_4"] == "testing"


def test_should_set_pipeline_name_with_specific_relative_base_dir():
Pipeline.set_pipeline_name_env_vars(Path("./some/random/path"), PIPELINE_PATH)

assert "for-testing" == ENV["pipeline_name"]
assert "for" == ENV["pipeline_name_0"]
assert "testing" == ENV["pipeline_name_1"]
assert ENV["pipeline_name"] == "for-testing"
assert ENV["pipeline_name_0"] == "for"
assert ENV["pipeline_name_1"] == "testing"


def test_should_set_pipeline_name_with_specific_absolute_base_dir():
Pipeline.set_pipeline_name_env_vars(Path("some/random/path"), PIPELINE_PATH)

assert "for-testing" == ENV["pipeline_name"]
assert "for" == ENV["pipeline_name_0"]
assert "testing" == ENV["pipeline_name_1"]
assert ENV["pipeline_name"] == "for-testing"
assert ENV["pipeline_name_0"] == "for"
assert ENV["pipeline_name_1"] == "testing"


def test_should_set_pipeline_name_with_absolute_base_dir():
Pipeline.set_pipeline_name_env_vars(Path.cwd(), PIPELINE_PATH)

assert "some-random-path-for-testing" == ENV["pipeline_name"]
assert "some" == ENV["pipeline_name_0"]
assert "random" == ENV["pipeline_name_1"]
assert "path" == ENV["pipeline_name_2"]
assert "for" == ENV["pipeline_name_3"]
assert "testing" == ENV["pipeline_name_4"]
assert ENV["pipeline_name"] == "some-random-path-for-testing"
assert ENV["pipeline_name_0"] == "some"
assert ENV["pipeline_name_1"] == "random"
assert ENV["pipeline_name_2"] == "path"
assert ENV["pipeline_name_3"] == "for"
assert ENV["pipeline_name_4"] == "testing"


def test_should_not_set_pipeline_name_with_the_same_base_dir():
4 changes: 2 additions & 2 deletions tests/components/test_kubernetes_app.py
Original file line number Diff line number Diff line change
@@ -195,8 +195,8 @@ def test_should_raise_not_implemented_error_when_helm_chart_is_not_set(
kubernetes_app.deploy(True)
helm_mock.add_repo.assert_called()
assert (
"Please implement the helm_chart property of the kpops.components.base_components.kubernetes_app module."
== str(error.value)
str(error.value)
== "Please implement the helm_chart property of the kpops.components.base_components.kubernetes_app module."
)

def test_should_call_helm_uninstall_when_destroying_kubernetes_app(