scripts: twister: Apply ruff to environment.py #81714
Draft
+768
−476
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
ortwisterlib
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.