1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 19:32:19 +01:00

[ruff] Enable RET and fix all violations (#9929)

This commit is contained in:
J. Nick Koston
2025-07-31 16:10:56 -10:00
committed by GitHub
parent 7a4738ec4e
commit f13e742bd5
39 changed files with 81 additions and 139 deletions

View File

@@ -43,12 +43,11 @@ CONFIG_ADC=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:
@@ -57,6 +56,7 @@ CONFIG_ADC=y
if not cxx_path.endswith("++"):
continue
return cxx_path
return None
def get_builtin_include_paths(compiler):
result = subprocess.run(
@@ -84,11 +84,10 @@ CONFIG_ADC=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)