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

scripts: twister: Apply ruff to environment.py #81714

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LukaszMrugala
Copy link
Collaborator

Ruff formatting applied to environment.py file.
Linting problems detected by ruff fixed.
As this majorly changes file lines, help strings were normalised as multiline strings.
Parameters mentioned in help strings now are inside quotation marks.
All quotation marks inside help strings changed to single quotes.
Minor typos and grammar errors fixed.

Unit test changed to incorporate changes.

We didn't want to make a have commit fixing all ruff formatting, as it would be too big and unwieldy. (As I understand the discussion in the PR introducing ruff here) Instead, we wanted a gradual and incremental approach, where new files would adhere to ruff and old ones would get there >eventually<.

However, coupling such big formatting changes with logic changes can make the differences and bugs hard to spot in the PR, so it would be better to bring up the older files in separate PRs. Otherwise, we may never have compliant Twister files.

Concerning Twister, twisterlib is my main concern. The environment.py was deemed a good starting point. After those, I'd like to tackle the Twister test files.

The matter of PR sizes is an open question that I'd like to introduce here. Should there be a PR per file? One PR per directory group (e.g. pylib or twisterlib in this case)? Every file touched by the formatter can often be majorly changed, so I'd assume that the number of additions and deletions is a good guide.

Ruff formatting applied to environment.py file.
Linting problems detected by ruff fixed.
As this majorly changes file lines, help strings
were normalised as multiline strings.
Parameters mentioned in help strings now are
inside quotation marks.
All quotation marks inside help strings
changed to single quotes.
Minor typos and grammar errors fixed.

Unit test changed to incorporate changes.

Signed-off-by: Lukasz Mrugala <[email protected]>
@pdgendt
Copy link
Collaborator

pdgendt commented Nov 21, 2024

For traceability I would advice to focus on the linter fixes and leave the formatting for now. The linter fixes are currently hidden and might have side-effects that need to be looked at in a review.

@LukaszMrugala
Copy link
Collaborator Author

For traceability I would advice to focus on the linter fixes and leave the formatting for now. The linter fixes are currently hidden and might have side-effects that need to be looked at in a review.

I'd wager that linter fixes could be bunched together, as the aren't as expansive as formatter-based changes. I didn't verify all files, but I might be able to bundle all twisterlib linter fixes in one PR.

@pdgendt
Copy link
Collaborator

pdgendt commented Nov 21, 2024

I have done something similar for the west runners here #81667

@LukaszMrugala
Copy link
Collaborator Author

I have done something similar for the west runners here #81667

I'll maybe keep this one as a draft, so as to first have the fixes merged (via a separate PR akin to yours for west runners), and then do reformatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants