From 79cfef02d92aa322875f9aa610e0e1272fc02f70 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 4 Jul 2019 19:31:02 +0200 Subject: [PATCH 1/2] Use the docstring in the command line help --- tests/scripts/check-files.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/tests/scripts/check-files.py b/tests/scripts/check-files.py index 00fd0edfb..a658415dc 100755 --- a/tests/scripts/check-files.py +++ b/tests/scripts/check-files.py @@ -1,11 +1,9 @@ #!/usr/bin/env python3 + +# This file is part of Mbed TLS (https://tls.mbed.org) +# Copyright (c) 2018, Arm Limited, All Rights Reserved + """ -This file is part of Mbed TLS (https://tls.mbed.org) - -Copyright (c) 2018, Arm Limited, All Rights Reserved - -Purpose - This script checks the current state of the source code for minor issues, including incorrect file permissions, presence of tabs, non-Unix line endings, trailing whitespace, presence of UTF-8 BOM, and TODO comments. @@ -257,15 +255,7 @@ class IntegrityChecker(object): def run_main(): - parser = argparse.ArgumentParser( - description=( - "This script checks the current state of the source code for " - "minor issues, including incorrect file permissions, " - "presence of tabs, non-Unix line endings, trailing whitespace, " - "presence of UTF-8 BOM, and TODO comments. " - "Note: requires python 3, must be run from Mbed TLS root." - ) - ) + parser = argparse.ArgumentParser(description=__doc__) parser.add_argument( "-l", "--log_file", type=str, help="path to optional output log", ) From 47d7c2d7cb4d6fb813751e3c1fcedac22730545b Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 4 Jul 2019 19:31:33 +0200 Subject: [PATCH 2/2] Allow TODO in code Don't reject TODO in code. Fix #2587 --- tests/scripts/check-files.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/tests/scripts/check-files.py b/tests/scripts/check-files.py index a658415dc..255bed8b9 100755 --- a/tests/scripts/check-files.py +++ b/tests/scripts/check-files.py @@ -6,7 +6,7 @@ """ This script checks the current state of the source code for minor issues, including incorrect file permissions, presence of tabs, non-Unix line endings, -trailing whitespace, presence of UTF-8 BOM, and TODO comments. +trailing whitespace, and presence of UTF-8 BOM. Note: requires python 3, must be run from Mbed TLS root. """ @@ -168,19 +168,6 @@ class MergeArtifactIssueTracker(LineIssueTracker): return True return False -class TodoIssueTracker(LineIssueTracker): - """Track lines containing ``TODO``.""" - - heading = "TODO present:" - files_exemptions = frozenset([ - os.path.basename(__file__), - "benchmark.c", - "pull_request_template.md", - ]) - - def issue_with_line(self, line, _filepath): - return b"todo" in line.lower() - class IntegrityChecker(object): """Sanity-check files under the current directory.""" @@ -209,7 +196,6 @@ class IntegrityChecker(object): TrailingWhitespaceIssueTracker(), TabIssueTracker(), MergeArtifactIssueTracker(), - TodoIssueTracker(), ] @staticmethod