More accurate variable name

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2020-05-10 16:52:44 +02:00
parent eee1f3b0c1
commit 05a51a8a72

View file

@ -23,13 +23,13 @@ class FileIssueTracker:
To implement a checker that processes a file as a whole, inherit from To implement a checker that processes a file as a whole, inherit from
this class and implement `check_file_for_issue` and define ``heading``. this class and implement `check_file_for_issue` and define ``heading``.
``files_exemptions``: files whose name ends with a string in this set ``suffix_exemptions``: files whose name ends with a string in this set
will not be checked. will not be checked.
``heading``: human-readable description of the issue ``heading``: human-readable description of the issue
""" """
files_exemptions = frozenset() suffix_exemptions = frozenset()
# heading must be defined in derived classes. # heading must be defined in derived classes.
# pylint: disable=no-member # pylint: disable=no-member
@ -39,10 +39,10 @@ class FileIssueTracker:
def should_check_file(self, filepath): def should_check_file(self, filepath):
"""Whether the given file name should be checked. """Whether the given file name should be checked.
Files whose name ends with a string listed in ``self.files_exemptions`` Files whose name ends with a string listed in ``self.suffix_exemptions``
will not be checked. or whose path matches ``self.path_exemptions`` will not be checked.
""" """
for files_exemption in self.files_exemptions: for files_exemption in self.suffix_exemptions:
if filepath.endswith(files_exemption): if filepath.endswith(files_exemption):
return False return False
return True return True
@ -138,7 +138,7 @@ class Utf8BomIssueTracker(FileIssueTracker):
heading = "UTF-8 BOM present:" heading = "UTF-8 BOM present:"
files_exemptions = frozenset([".vcxproj", ".sln"]) suffix_exemptions = frozenset([".vcxproj", ".sln"])
def check_file_for_issue(self, filepath): def check_file_for_issue(self, filepath):
with open(filepath, "rb") as f: with open(filepath, "rb") as f:
@ -174,7 +174,7 @@ class TrailingWhitespaceIssueTracker(LineIssueTracker):
"""Track lines with trailing whitespace.""" """Track lines with trailing whitespace."""
heading = "Trailing whitespace:" heading = "Trailing whitespace:"
files_exemptions = frozenset([".dsp", ".md"]) suffix_exemptions = frozenset([".dsp", ".md"])
def issue_with_line(self, line, _filepath): def issue_with_line(self, line, _filepath):
return line.rstrip(b"\r\n") != line.rstrip() return line.rstrip(b"\r\n") != line.rstrip()
@ -184,7 +184,7 @@ class TabIssueTracker(LineIssueTracker):
"""Track lines with tabs.""" """Track lines with tabs."""
heading = "Tabs present:" heading = "Tabs present:"
files_exemptions = frozenset([ suffix_exemptions = frozenset([
".sln", ".sln",
"/Makefile", "/Makefile",
"/Makefile.inc", "/Makefile.inc",