Skip to content

[tooling] Switch to ruff #1096

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

[tooling] Switch to ruff #1096

wants to merge 5 commits into from

Conversation

the-glu
Copy link
Contributor

@the-glu the-glu commented Aug 5, 2025

This PR follow #1094

This replace black and isort by ruff.

For now, it use the default ruff configuration + isort. I do plan to add more rules incrementally when they are useful (e.g. pyupgrade) in separate PR to minimize changes.

It's spited in 3 commits:

  • e55564b Where ruff is configured
  • 40a2a5c Where ruff format is automatically applied
  • b98dfdc For manual changes dues to various errors. I added some comments for the rationale for the fix but I may be wrong, please check it :)

I also had to apply manual fixes for import (in the second commit) dues to some strange imports of modules / submodules, making some undetected and ruff removing them, but they are 1-1 style-only changes like the rest of the commit.

Mostly tested by the fact that tests are still passing, so parts tests are not done should probably be checked carefully.

@the-glu the-glu force-pushed the ruff branch 4 times, most recently from 2546719 to 55e4d58 Compare August 7, 2025 09:42
@@ -6,7 +6,6 @@
import flask
from implicitdict import ImplicitDict
from loguru import logger
from uas_standards.astm.f3411.v19.api import ErrorResponse
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Redefined bellow. I assumed this file version is the one needed ? (message not optional here)

@@ -42,7 +42,7 @@
)
from uas_standards.astm.f3548.v21.constants import Scope

from monitoring.monitorlib import fetch, infrastructure
Copy link
Contributor Author

Choose a reason for hiding this comment

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

defined bellow from fetch.scd (and use scd methods in the file)

@@ -45,7 +45,7 @@ def sub_get_query(
if not fetched_sub.success:
check.record_failed(
summary="Subscription query failed",
details=f"Failed to query subscription {sub_id} referenced by oid {self._oir_a_id} with code {fetched_sub.response.status_code}. Message: {fetched_sub.error_message}",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

_oir_a_id is defined in class OIRImplicitSubHandling(TestScenario), I did assumed that the scenario variable

@@ -1128,7 +1128,6 @@ def check_sub_not_none(oir):
check.record_failed(
summary="OIR not attached to any subscription",
details="OIR is not attached to any subscription, when a request for an implicit subscription was made.",
query_timestamps=[mutate_q.timestamp],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

probably a copy-paste error from others similar methods, I did assume there are no query there.

@@ -39,7 +39,7 @@ def run(self, context):
if not reports:
self.record_note(
"Skip reason",
f"Nominal behavior test scenario report could not be found for any of the scenario types {', '.join(SCENARIO_TYPES)}",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Scenario type seems to be a find_test_scenario_reports parameter, who is fixed to NominalBehavior here. Since 'Nominal behavior' is already in the text I just removed it.

@the-glu the-glu marked this pull request as ready for review August 7, 2025 11:36
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.

1 participant