pylint: fix various errors caught by 3.2 In preparation for adding to CI run_tests, cleanup the current codebase. Bug: None Test: `./run_tests` Change-Id: Ie1a07b644b6b3405cb347e2cc062818d0b6bdc51 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repohooks/+/556725 Reviewed-by: Raul Rangel <rrangel@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
diff --git a/pre-upload.py b/pre-upload.py index a51707c..7117cad 100755 --- a/pre-upload.py +++ b/pre-upload.py
@@ -442,6 +442,7 @@ ) def run_hooks(hooks): + # pylint: disable=cell-var-from-loop futures = ( executor.submit( _run_hook, hook, project, commit, desc, diff
diff --git a/rh/hooks.py b/rh/hooks.py index 1ba3b8b..4750183 100644 --- a/rh/hooks.py +++ b/rh/hooks.py
@@ -1305,6 +1305,7 @@ # Hooks that projects can opt into. # Note: Make sure to keep the top level README.md up to date when adding more! BUILTIN_HOOKS = { + # pylint: disable=line-too-long "aidl_format": check_aidl_format, "alint": check_alint, "android_test_mapping_format": check_android_test_mapping,
diff --git a/rh/utils.py b/rh/utils.py index 0a599f3..f5aa041 100644 --- a/rh/utils.py +++ b/rh/utils.py
@@ -358,11 +358,11 @@ if isinstance(cmd, str): if not shell: - raise Exception("Cannot run a string command without a shell") + raise TypeError("Cannot run a string command without a shell") cmd = ["/bin/bash", "-c", cmd] shell = False elif shell: - raise Exception("Cannot run an array command with a shell") + raise TypeError("Cannot run an array command with a shell") # If we are using enter_chroot we need to use enterchroot pass env through # to the final command.
diff --git a/rh/utils_unittest.py b/rh/utils_unittest.py index 5b977cd..9de9186 100755 --- a/rh/utils_unittest.py +++ b/rh/utils_unittest.py
@@ -97,7 +97,7 @@ def test_basic(self): """Basic test we can create a normal instance.""" - rh.utils.CalledProcessError(0, ["mycmd"]) + _ = rh.utils.CalledProcessError(0, ["mycmd"]) def test_stringify(self): """Check stringify() handling."""