From 6eb9237645e0ad29afa699b714840eaf338266e2 Mon Sep 17 00:00:00 2001 From: Patrik Teivonen Date: Tue, 5 Jul 2022 14:19:26 +0300 Subject: pylint: Add miscellaneous checks Add comment about disabled checks in pylint hook and enable all default pylint checks except for those. Address these miscellaneous pylint warnings: -C0123: Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck) -R1714: Consider merging these comparisons with "in" (consider-using-in) -R1722: Consider using sys.exit() (consider-using-sys-exit) -C0206: Consider iterating with .items() (consider-using-dict-items) -R1710: All return statements in a function should return an expression. (inconsistent-return-statements) -W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from) -W1510: Using subprocess.run without explicitly set `check` is not recommended. (subprocess-run-check) -W0102: Dangerous default value as argument (dangerous-default-value) -W1508: os.getenv default type is builtins.bool. Expected str or None. (invalid-envvar-default) -W0212: Access to a protected member of a client class (protected-access) -W0631: Using possibly undefined loop variable (undefined-loop-variable) -W1113: Keyword argument before variable positional arguments list in the definition of __init__ function (keyword-arg-before-vararg) -W0201: Attribute defined outside __init__ (attribute-defined-outside-init) -W0221: Number of parameters in overridden method differ (arguments-differ) -C0202: Class method should have 'cls' as first argument (bad-classmethod-argument) -W1505: Using deprecated method currentThread() (deprecated-method) -R1707: Disallow trailing comma tuple (trailing-comma-tuple) -W0603: Using the global statement (global-statement) -W0602: Using global for 'OUTPUT_STATES' but no assignment is done (global-variable-not-assigned) -C2801: Unnecessarily calls dunder method __contains__. Use in keyword. Change-Id: Ia1c6ff3f6c328a94b40a1c0f11c83151abc91423 Reviewed-by: Iikka Eklund --- packaging-tools/bld_openssl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packaging-tools/bld_openssl.py') diff --git a/packaging-tools/bld_openssl.py b/packaging-tools/bld_openssl.py index 0dc6d9132..95b77b781 100644 --- a/packaging-tools/bld_openssl.py +++ b/packaging-tools/bld_openssl.py @@ -65,7 +65,7 @@ def check_environment(): def check_cmd(cmd): if subprocess.call(cmd, stdout=fnull, stderr=fnull) != 0: print(f"*** Cannot execute {cmd[0]}") - exit(1) + sys.exit(1) check_cmd(['nasm', '-h']) check_cmd(['nmake', '/?']) check_cmd(['7z']) @@ -96,7 +96,7 @@ def main() -> None: parser = setup_argument_parser() args = parser.parse_args() - if args.toolset != 'VC-WIN32' and args.toolset != 'VC-WIN64A': + if args.toolset not in ('VC-WIN32', 'VC-WIN64A'): print('*** --toolset must be either VC-WIN32 or VC-WIN64A') sys.exit(1) -- cgit v1.2.3