tc-build: Enable more Ruff lints#329
Merged
msfjarvis merged 6 commits intoClangBuiltLinux:mainfrom Apr 13, 2026
Merged
Conversation
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
As suggested by the refurb lints in Ruff:
FURB167 [*] Use of regular expression alias `re.M`
--> tc_build/llvm.py:585:94
|
583 | tool
584 | for cmakelists_txt in cmakelists_txts
585 | if (match := re.search(r"^add_(?:clang|llvm)_tool\((.*)$", cmakelists_txt, flags=re.M))
| ^^^^
586 | and (tool := match.groups()[0]) not in skip_tools
587 | ]
|
help: Replace with `re.MULTILINE`
FURB167 [*] Use of regular expression alias `re.M`
--> tc_build/source.py:45:85
|
43 | if not (
44 | match := re.search(
45 | rf"([0-9a-f]+)\s+{self.remote_tarball_name}$", checksums, flags=re.M
| ^^^^
46 | )
47 | ):
|
help: Replace with `re.MULTILINE`
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
As suggested by the refurb Ruff lints:
FURB110 [*] Replace ternary `if` expression with `or` operator
--> tc_build/source.py:93:31
|
91 | class SourceManager:
92 | def __init__(self, location: Optional[Path] = None) -> None:
93 | self.location: Path = location if location else tc_build.utils.UNINIT_PATH
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
94 | self.tarball = Tarball()
|
help: Replace with `or` operator
FURB110 [*] Replace ternary `if` expression with `or` operator
--> tc_build/utils.py:75:23
|
73 | # on.
74 | ldd_out = subprocess.run(['ldd', '--version'], capture_output=True, check=False, text=True)
75 | return 'musl' in (ldd_out.stderr if ldd_out.stderr else ldd_out.stdout)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: Replace with `or` operator
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
TRY003 fires too often in our code currently and its value is fairly low. Signed-off-by: Nathan Chancellor <nathan@kernel.org>
There are no instances of warnings in these categories currently. Signed-off-by: Nathan Chancellor <nathan@kernel.org>
msfjarvis
approved these changes
Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
See the individual commits for the full details.