Skip to content

Add ruff format check to ci.yml#2947

Merged
janiversen merged 4 commits into
pymodbus-dev:devfrom
km-64:ci/add-ruff-format-check
Jun 25, 2026
Merged

Add ruff format check to ci.yml#2947
janiversen merged 4 commits into
pymodbus-dev:devfrom
km-64:ci/add-ruff-format-check

Conversation

@km-64

@km-64 km-64 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Added format checking with ruff using ruff format --check.
See: #2944 (comment)

@janiversen janiversen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@janiversen janiversen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something seems a bit off, "ruff format --check" runs ok on dev, but this PR have an error

@km-64

km-64 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Looks like test/client/test_client.py is not formatted. @janiversen It looks like you formatted it recently. Maybe you're using a different version of ruff than I and the ci are using? I'm on ruff 0.15.18.

@km-64

km-64 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

When I run ruff format it wants to make these changes.

diff --git a/test/client/test_client.py b/test/client/test_client.py
index 7e9f5a4b..ee052c3c 100755
--- a/test/client/test_client.py
+++ b/test/client/test_client.py
@@ -380,7 +380,8 @@ class TestMixin:
 
         with pytest.raises(TypeError):
             ModbusClientMixin.convert_to_registers(
-                bool, ModbusClientMixin.DATATYPE.BITS  # type: ignore[arg-type]
+                bool,
+                ModbusClientMixin.DATATYPE.BITS,  # type: ignore[arg-type]
             )
 
     def test_client_mixin_convert_datatype_fail(self):

@janiversen

janiversen commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Looks correct, feel free to submit it as a separate PR.

I expect that Zuban will mark an error.

@janiversen

Copy link
Copy Markdown
Collaborator

Please do not mix code changes with CI changes.

@km-64

km-64 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

The problem was that ruff moved the ignore comment that zuban relied on. I formatted with ruff and fixed teh ignore comment in #2948.

@km-64

km-64 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

#2948 could be merged first. Then I can then merge those changes into this PR so that all the new ci checks pass. I'll tidy up this pr to only include changes to ci.yml.

@km-64 km-64 force-pushed the ci/add-ruff-format-check branch from 0065636 to dbee8fa Compare June 25, 2026 13:51

@janiversen janiversen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch (check_ci).

LGTM, thanks

@janiversen janiversen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets get it merged.

@janiversen janiversen merged commit 726bd90 into pymodbus-dev:dev Jun 25, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants