check-files.py: document some classes and methods
Document all classes and longer methods.
Declare a static method as such. Pointed out by pylint.
diff --git a/tests/scripts/check-files.py b/tests/scripts/check-files.py
index 005a077..92cae1d 100755
--- a/tests/scripts/check-files.py
+++ b/tests/scripts/check-files.py
@@ -66,6 +66,9 @@
class PermissionIssueTracker(IssueTracker):
+ """Track files with bad permissions.
+
+ Files that are not executable scripts must not be executable."""
def __init__(self):
super().__init__()
@@ -78,6 +81,8 @@
class EndOfFileNewlineIssueTracker(IssueTracker):
+ """Track files that end with an incomplete line
+ (no newline character at the end of the last line)."""
def __init__(self):
super().__init__()
@@ -90,6 +95,8 @@
class Utf8BomIssueTracker(IssueTracker):
+ """Track files that start with a UTF-8 BOM.
+ Files should be ASCII or UTF-8. Valid UTF-8 does not start with a BOM."""
def __init__(self):
super().__init__()
@@ -102,6 +109,7 @@
class LineEndingIssueTracker(IssueTracker):
+ """Track files with non-Unix line endings (i.e. files with CR)."""
def __init__(self):
super().__init__()
@@ -112,6 +120,7 @@
class TrailingWhitespaceIssueTracker(IssueTracker):
+ """Track lines with trailing whitespace."""
def __init__(self):
super().__init__()
@@ -123,6 +132,7 @@
class TabIssueTracker(IssueTracker):
+ """Track lines with tabs."""
def __init__(self):
super().__init__()
@@ -136,6 +146,8 @@
class MergeArtifactIssueTracker(IssueTracker):
+ """Track lines with merge artifacts.
+ These are leftovers from a ``git merge`` that wasn't fully edited."""
def __init__(self):
super().__init__()
@@ -157,6 +169,7 @@
self.record_issue(filepath, line_number)
class TodoIssueTracker(IssueTracker):
+ """Track lines containing ``TODO``."""
def __init__(self):
super().__init__()
@@ -172,8 +185,12 @@
class IntegrityChecker(object):
+ """Sanity-check files under the current directory."""
def __init__(self, log_file):
+ """Instantiate the sanity checker.
+ Check files under the current directory.
+ Write a report of issues to log_file."""
self.check_repo_path()
self.logger = None
self.setup_logger(log_file)
@@ -197,7 +214,8 @@
TodoIssueTracker(),
]
- def check_repo_path(self):
+ @staticmethod
+ def check_repo_path():
if not all(os.path.isdir(d) for d in ["include", "library", "tests"]):
raise Exception("Must be run from Mbed TLS root")