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 <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2020-03-24 22:01:28 +01:00
parent 29b7b9585b
commit c251e0d75a

View File

@ -143,8 +143,8 @@ class TabIssueTracker(LineIssueTracker):
heading = "Tabs present:"
files_exemptions = frozenset([
"Makefile",
"generate_visualc_files.pl",
"/Makefile",
"/generate_visualc_files.pl",
])
def issue_with_line(self, line, _filepath):
@ -179,9 +179,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", "CMakeLists.txt", "ChangeLog"
"/Makefile", "/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):