From e8a34cbfc632d015b2c0c27058489e4f84d01d35 Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Thu, 7 Jul 2022 18:34:10 -0400 Subject: [PATCH 1/3] fix logic error in include_checker.py The current if statement always evaluates to false, so no files get checked --- cpp/scripts/include_checker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/scripts/include_checker.py b/cpp/scripts/include_checker.py index ffd6c55c4b..fd7a2714db 100644 --- a/cpp/scripts/include_checker.py +++ b/cpp/scripts/include_checker.py @@ -44,7 +44,7 @@ def list_all_source_file(file_regex, srcdirs): for srcdir in srcdirs: for root, dirs, files in os.walk(srcdir): for f in files: - if not re.search(file_regex, f) and re.search(file_regex, f): + if re.search(file_regex, f): src = os.path.join(root, f) all_files.append(src) return all_files From fb747d472e577a43be9be53845fa795ae2f0c102 Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Thu, 7 Jul 2022 18:51:43 -0400 Subject: [PATCH 2/3] actually use the already-defined exclusion_regex --- cpp/scripts/include_checker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/scripts/include_checker.py b/cpp/scripts/include_checker.py index fd7a2714db..e40412abe9 100644 --- a/cpp/scripts/include_checker.py +++ b/cpp/scripts/include_checker.py @@ -44,7 +44,7 @@ def list_all_source_file(file_regex, srcdirs): for srcdir in srcdirs: for root, dirs, files in os.walk(srcdir): for f in files: - if re.search(file_regex, f): + if not re.search(exclusion_regex, f) and re.search(file_regex, f): src = os.path.join(root, f) all_files.append(src) return all_files From 31c5fa384c4f90b8f1ad5a81582aed17d80a424e Mon Sep 17 00:00:00 2001 From: Gregory Lee Date: Fri, 8 Jul 2022 13:50:39 -0400 Subject: [PATCH 3/3] exclusion_regex needs to be applied to the root dir, not f --- cpp/scripts/include_checker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/scripts/include_checker.py b/cpp/scripts/include_checker.py index e40412abe9..6c1ad089e5 100644 --- a/cpp/scripts/include_checker.py +++ b/cpp/scripts/include_checker.py @@ -44,7 +44,7 @@ def list_all_source_file(file_regex, srcdirs): for srcdir in srcdirs: for root, dirs, files in os.walk(srcdir): for f in files: - if not re.search(exclusion_regex, f) and re.search(file_regex, f): + if not re.search(exclusion_regex, root) and re.search(file_regex, f): src = os.path.join(root, f) all_files.append(src) return all_files