Skip to content

Commit f39f0b5

Browse files
committed
address pr comments
1 parent 6688a60 commit f39f0b5

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

clang-tools-extra/clang-tidy/tool/run-clang-tidy.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ def aggregate_profiles(profile_dir: str) -> Dict[str, float]:
198198
aggregated[key] += value
199199
else:
200200
aggregated[key] = value
201-
except (json.JSONDecodeError, KeyError, IOError):
202-
# Skip malformed or unreadable files
201+
except (json.JSONDecodeError, KeyError, IOError) as e:
202+
print(f"Warning: invalid json file {profile_file}: {e}", file=sys.stderr)
203203
continue
204204

205205
return aggregated
@@ -617,10 +617,8 @@ async def main() -> None:
617617
delete_fixes_dir = True
618618

619619
profile_dir: Optional[str] = None
620-
delete_profile_dir = False
621620
if args.enable_check_profile:
622621
profile_dir = tempfile.mkdtemp()
623-
delete_profile_dir = True
624622

625623
try:
626624
invocation = get_tidy_invocation(
@@ -728,8 +726,7 @@ async def main() -> None:
728726
if delete_fixes_dir:
729727
assert export_fixes_dir
730728
shutil.rmtree(export_fixes_dir)
731-
if delete_profile_dir:
732-
assert profile_dir
729+
if profile_dir:
733730
shutil.rmtree(profile_dir)
734731
return
735732

@@ -763,8 +760,7 @@ async def main() -> None:
763760
if delete_fixes_dir:
764761
assert export_fixes_dir
765762
shutil.rmtree(export_fixes_dir)
766-
if delete_profile_dir:
767-
assert profile_dir
763+
if profile_dir:
768764
shutil.rmtree(profile_dir)
769765
sys.exit(returncode)
770766

0 commit comments

Comments
 (0)