From 1633932dc6ae8383dbfbf0d1bb2064fd1ddcbe26 Mon Sep 17 00:00:00 2001 From: Alberto Soragna Date: Sun, 5 Nov 2023 13:07:41 -0800 Subject: [PATCH] remove AMENT_IGNORE check in clang-tidy when looking for compilation db (#441) * remove AMENT_IGNORE check in clang-tidy when looking for compilation database * add comment explaining why we don't check for AMENT_IGNORE Signed-off-by: Alberto Soragna --- ament_clang_tidy/ament_clang_tidy/main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ament_clang_tidy/ament_clang_tidy/main.py b/ament_clang_tidy/ament_clang_tidy/main.py index f2b7eeab..913d842a 100755 --- a/ament_clang_tidy/ament_clang_tidy/main.py +++ b/ament_clang_tidy/ament_clang_tidy/main.py @@ -277,9 +277,13 @@ def get_compilation_db_files(paths): for path in paths: if os.path.isdir(path): for dirpath, dirnames, filenames in os.walk(path): - if 'AMENT_IGNORE' in dirnames + filenames: - dirnames[:] = [] - continue + # NOTE: here we don't check for the AMENT_IGNORE file. + # This function tries to find compile_commands.json file in the build folders. + # Build folders always include a AMENT_IGNORE file, so checking for it would + # result in not finding any compilation db. The check would also be redundant + # because if a source folder was marked with AMENT_IGNORE, then + # the compile_commands.json will not be present in relevant build folder. + # ignore folder starting with . or _ dirnames[:] = [d for d in dirnames if d[0] not in ['.', '_']] dirnames.sort()