Skip to content

continuous-integration2: Switch to ruff for Python formatting#924

Merged
nathanchance merged 1 commit into
ClangBuiltLinux:mainfrom
nathanchance:ruff-format
Mar 25, 2026
Merged

continuous-integration2: Switch to ruff for Python formatting#924
nathanchance merged 1 commit into
ClangBuiltLinux:mainfrom
nathanchance:ruff-format

Conversation

@nathanchance

Copy link
Copy Markdown
Member

We started using ruff for linting a while ago. Since then, it has grown a formatting option, which is quite fast. While it is a little less flexible than yapf, we don't currently customize the behavior aside from some exemptions.

Switch to ruff for formatting. Most of the changes end up making the code a little more readable, at the expense of some extra lines. Switch to the generic fmt comments instead of the yapf specific ones. Use the option to preserve our quoting style, which uses single quotes for string literals and double quotes for f-string or raw strings.

NOTE: The linting job will not succeed until ClangBuiltLinux/actions-workflows#11 is merged.

We started using ruff for linting a while ago. Since then, it has grown
a formatting option, which is quite fast. While it is a little less
flexible than YAPF, we don't currently customize the behavior aside from
some exemptions.

Switch to ruff for formatting. Most of the changes end up making the
code a little more readable, at the expense of some extra lines. Switch
to the generic fmt comments instead of the yapf specific ones. Use the
option to preserve our quoting style, which uses single quotes for
string literals and double quotes for f-string or raw strings.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
@JustinStitt

Copy link
Copy Markdown
Contributor

I feel like a couple of the formatting changes it made kinda suck

For example:

- x["name"] for x in json.loads(list_response.content)["variables"]
+ x["name"]
+ for x in json.loads(list_response.content)["variables"]

... but I suspect this repo is getting nuked soon so I'm not blocking over this 😆

@nathanchance

Copy link
Copy Markdown
Member Author

I feel like a couple of the formatting changes it made kinda suck

For example:

- x["name"] for x in json.loads(list_response.content)["variables"]
+ x["name"]
+ for x in json.loads(list_response.content)["variables"]

... but I suspect this repo is getting nuked soon so I'm not blocking over this 😆

Yeah, I did think this too but I think the vast majority of the changes are good enough that it is not worth splitting hairs over. Thanks for taking a look!

@nathanchance nathanchance merged commit 6f8c2a4 into ClangBuiltLinux:main Mar 25, 2026
11 of 16 checks passed
@nathanchance nathanchance deleted the ruff-format branch March 25, 2026 03:55
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