From 6e8d5a00b2e74a0984100b50a2004e6e79a5d50f Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 24 Mar 2020 22:01:28 +0100 Subject: [PATCH] Clarify confusion between file names and suffixes of file names To test a file name exactly, prepend a / to the base name. files_to_check actually checks suffixes, not file names, so rename it to extensions_to_check. Signed-off-by: Gilles Peskine --- tests/scripts/check-files.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/scripts/check-files.py b/tests/scripts/check-files.py index 6e35f5224..3d966d877 100755 --- a/tests/scripts/check-files.py +++ b/tests/scripts/check-files.py @@ -143,9 +143,9 @@ class TabIssueTracker(LineIssueTracker): heading = "Tabs present:" files_exemptions = frozenset([ - "Makefile", - "Makefile.inc", - "generate_visualc_files.pl", + "/Makefile", + "/Makefile.inc", + "/generate_visualc_files.pl", ]) def issue_with_line(self, line, _filepath): @@ -180,9 +180,9 @@ class IntegrityChecker(object): self.check_repo_path() self.logger = None self.setup_logger(log_file) - self.files_to_check = ( + self.extensions_to_check = ( ".c", ".h", ".sh", ".pl", ".py", ".md", ".function", ".data", - "Makefile", "Makefile.inc", "CMakeLists.txt", "ChangeLog" + "/Makefile", "/Makefile.inc", "/CMakeLists.txt", "/ChangeLog" ) self.excluded_directories = ['.git', 'mbed-os'] self.excluded_paths = list(map(os.path.normpath, [ @@ -226,7 +226,7 @@ class IntegrityChecker(object): dirs[:] = sorted(d for d in dirs if not self.prune_branch(root, d)) for filename in sorted(files): filepath = os.path.join(root, filename) - if not filepath.endswith(self.files_to_check): + if not filepath.endswith(self.extensions_to_check): continue for issue_to_check in self.issues_to_check: if issue_to_check.should_check_file(filepath):