From de047b09fe1f7c2ee878a0cc7b6f75f4cf429649 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 4 Mar 2024 11:51:31 +0100 Subject: [PATCH] Add docstrings to pacify pylint Signed-off-by: Gilles Peskine --- tests/scripts/check_files.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/scripts/check_files.py b/tests/scripts/check_files.py index 5e4a7247ec..a15a058f0e 100755 --- a/tests/scripts/check_files.py +++ b/tests/scripts/check_files.py @@ -468,6 +468,7 @@ class IntegrityChecker: ] def setup_logger(self, log_file, level=logging.INFO): + """Log to log_file if provided, or to stderr if None.""" self.logger = logging.getLogger() self.logger.setLevel(level) if log_file: @@ -479,6 +480,10 @@ class IntegrityChecker: @staticmethod def collect_files(): + """Return the list of files to check. + + These are the regular files commited into Git. + """ bytes_output = subprocess.check_output(['git', 'ls-files', '-z']) bytes_filepaths = bytes_output.split(b'\0')[:-1] ascii_filepaths = map(lambda fp: fp.decode('ascii'), bytes_filepaths) @@ -495,12 +500,17 @@ class IntegrityChecker: for fp in ascii_filepaths] def check_files(self): + """Check all files for all issues.""" for issue_to_check in self.issues_to_check: for filepath in self.collect_files(): if issue_to_check.should_check_file(filepath): issue_to_check.check_file_for_issue(filepath) def output_issues(self): + """Log the issues found and their locations. + + Return 1 if there were issues, 0 otherwise. + """ integrity_return_code = 0 for issue_to_check in self.issues_to_check: if issue_to_check.files_with_issues: