1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-04 12:22:20 +01:00

[ruff] Enable RET and fix all violations

This commit is contained in:
J. Nick Koston
2025-07-27 08:34:43 -10:00
parent 14862904ac
commit a4026d6ba1
39 changed files with 79 additions and 133 deletions

View File

@@ -42,12 +42,11 @@ CONFIG_NEWLIB_LIBC=y
def extract_defines(command):
define_pattern = re.compile(r"-D\s*([^\s]+)")
defines = [
return [
match
for match in define_pattern.findall(command)
if match not in ("_ASMLANGUAGE")
]
return defines
def find_cxx_path(commands):
for entry in commands:
@@ -56,6 +55,7 @@ CONFIG_NEWLIB_LIBC=y
if not cxx_path.endswith("++"):
continue
return cxx_path
return None
def get_builtin_include_paths(compiler):
result = subprocess.run(
@@ -83,11 +83,10 @@ CONFIG_NEWLIB_LIBC=y
flag_pattern = re.compile(
r"(-O[0-3s]|-g|-std=[^\s]+|-Wall|-Wextra|-Werror|--[^\s]+|-f[^\s]+|-m[^\s]+|-imacros\s*[^\s]+)"
)
flags = [
return [
match.replace("-imacros ", "-imacros")
for match in flag_pattern.findall(command)
]
return flags
def transform_to_idedata_format(compile_commands):
cxx_path = find_cxx_path(compile_commands)