[clang-tools-extra] [clang-tidy][NFC] Run ruff over python scripts (PR #176927)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 20 09:15:20 PST 2026
================
@@ -410,17 +408,13 @@ def filename_from_module(module_name: str, check_name: str) -> str:
with io.open(module_file, "r") as f:
code = f.read()
full_check_name = module_name + "-" + check_name
- name_pos = code.find('"' + full_check_name + '"')
- if name_pos == -1:
+ if (name_pos := code.find('"' + full_check_name + '"')) == -1:
return ""
- stmt_end_pos = code.find(";", name_pos)
- if stmt_end_pos == -1:
- return ""
- stmt_start_pos = code.rfind(";", 0, name_pos)
- if stmt_start_pos == -1:
- stmt_start_pos = code.rfind("{", 0, name_pos)
- if stmt_start_pos == -1:
+ if (stmt_end_pos := code.find(";", name_pos)) == -1:
return ""
+ if (stmt_start_pos := code.rfind(";", 0, name_pos)) == -1:
+ if (stmt_start_pos := code.rfind("{", 0, name_pos)) == -1:
----------------
EugeneZelenko wrote:
Could be merged with `and`.
https://github.com/llvm/llvm-project/pull/176927
More information about the cfe-commits
mailing list