Enforce Python style on testing/tools
Opts PDFium testing/tools scripts into Pylint and auto-formatting,
following the directions at
https://chromium.googlesource.com/chromium/src/+/master/styleguide/python/python.md.
Cleaned up existing lint warnings:
1. Removed unused parameters and variables.
2. Renamed shadowing names.
3. Wrapped top-level statements to fix scoping issues.
4. Fixed a long line.
5. Suppressed warnings about (implicit) relative imports. Fixing this
properly will require separating "scripts" and "packages".
6. Suppressed warnings about defining attributes in Run() methods.
Miscellaneous changes:
7. Filtered non-C++ files from top-level CheckChangeLintsClean check.
(This check runs cpplint, and was triggering on PRESUBMIT.py.)
Change-Id: I8c25b3df433420bdfc9310e93f7e82d21396a458
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/63153
Commit-Queue: K Moon <kmoon@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/testing/tools/safetynet_compare.py b/testing/tools/safetynet_compare.py
index 00c67a8..c76ce44 100755
--- a/testing/tools/safetynet_compare.py
+++ b/testing/tools/safetynet_compare.py
@@ -16,6 +16,7 @@
import sys
import tempfile
+# pylint: disable=relative-import
from common import GetBooleanGnArg
from common import PrintErr
from common import RunCommandPropagateErr
@@ -122,8 +123,8 @@
self.__FreezeFile(os.path.join('testing', 'tools', 'safetynet_measure.py'))
self.__FreezeFile(os.path.join('testing', 'tools', 'common.py'))
- def __FreezeFile(self, file):
- RunCommandPropagateErr(['cp', file, self.safe_script_dir],
+ def __FreezeFile(self, filename):
+ RunCommandPropagateErr(['cp', filename, self.safe_script_dir],
exit_status_on_error=1)
def _ProfileTwoOtherBranchesInThisRepo(self, before_branch, after_branch):