boot-utils: Fixes for flake8 and pylint#80
Merged
Conversation
Due to what appears to be a yapf bug. boot-qemu.py:60:14: E251 unexpected spaces around keyword / parameter equals boot-qemu.py:68:14: E251 unexpected spaces around keyword / parameter equals boot-qemu.py:74:14: E251 unexpected spaces around keyword / parameter equals boot-qemu.py:81:14: E251 unexpected spaces around keyword / parameter equals boot-uml.py:25:14: E251 unexpected spaces around keyword / parameter equals boot-uml.py:33:14: E251 unexpected spaces around keyword / parameter equals Link: google/yapf#393 Signed-off-by: Nathan Chancellor <nathan@kernel.org>
As recommended by pylint: boot-qemu.py:698:12: R1722: Consider using sys.exit() (consider-using-sys-exit) utils.py:29:4: R1722: Consider using sys.exit() (consider-using-sys-exit) Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Cleans up the following pylint warnings:
utils.py:55:11: R1714: Consider merging these comparisons with 'in' by using 'image in ('vmlinux', 'linux')'. Use a set instead if elements are hashable. (consider-using-in)
boot-qemu.py:124:19: R1714: Consider merging these comparisons with 'in' by using 'guest_arch in ('arm', 'arm32_v7')'. Use a set instead if elements are hashable. (consider-using-in)
boot-qemu.py:404:9: R1714: Consider merging these comparisons with 'in' by using 'arch in ('arm', 'arm32_v7')'. Use a set instead if elements are hashable. (consider-using-in)
boot-qemu.py:414:9: R1714: Consider merging these comparisons with 'in' by using 'arch in ('arm64', 'arm64be')'. Use a set instead if elements are hashable. (consider-using-in)
boot-qemu.py:456:9: R1714: Consider merging these comparisons with 'in' by using 'arch in ('mips', 'mipsel')'. Use a set instead if elements are hashable. (consider-using-in)
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Helps compact code and eliminate the following pylint warnings: boot-qemu.py:132:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) boot-qemu.py:132:46: C0103: Variable name "f" doesn't conform to snake_case naming style (invalid-name) Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Elminate the following pylint warnings: boot-qemu.py:190:13: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) boot-qemu.py:190:34: C0103: Variable name "f" doesn't conform to snake_case naming style (invalid-name) Signed-off-by: Nathan Chancellor <nathan@kernel.org>
As suggested by pylint: boot-qemu.py:666:27: R1732: Consider using 'with' for resource-allocating operations (consider-using-with) This allows us to drop the explicit call to wait(), as the exit path for Popen() as a context manager automatically calls wait(). Signed-off-by: Nathan Chancellor <nathan@kernel.org>
An explicit check parameter is recommended to make it obvious what the error handling is. Cleans up the following pylint warnings: boot-qemu.py:127:39: W1510: Using subprocess.run without explicitly set `check` is not recommended. (subprocess-run-check) boot-qemu.py:659:19: W1510: Using subprocess.run without explicitly set `check` is not recommended. (subprocess-run-check) boot-qemu.py:672:16: W1510: Using subprocess.run without explicitly set `check` is not recommended. (subprocess-run-check) Signed-off-by: Nathan Chancellor <nathan@kernel.org>
As recommended by pylint: boot-uml.py:47:4: W0621: Redefining name 'rootfs' from outer scope (line 80) (redefined-outer-name) boot-uml.py:60:15: W0621: Redefining name 'kernel' from outer scope (line 79) (redefined-outer-name) boot-uml.py:60:23: W0621: Redefining name 'rootfs' from outer scope (line 80) (redefined-outer-name) boot-qemu.py:141:18: W0621: Redefining name 'args' from outer scope (line 703) (redefined-outer-name) boot-qemu.py:202:14: W0621: Redefining name 'args' from outer scope (line 703) (redefined-outer-name) boot-qemu.py:322:26: W0621: Redefining name 'cfg' from outer scope (line 706) (redefined-outer-name) boot-qemu.py:356:18: W0621: Redefining name 'cfg' from outer scope (line 706) (redefined-outer-name) boot-qemu.py:632:16: W0621: Redefining name 'cfg' from outer scope (line 706) (redefined-outer-name) As it turns out, this caught a bug in can_use_kvm(), where args was being used without being passed into the function. Signed-off-by: Nathan Chancellor <nathan@kernel.org>
These are scripts, not modules. boot-uml.py:1:0: C0103: Module name "boot-uml" doesn't conform to snake_case naming style (invalid-name) boot-qemu.py:1:0: C0103: Module name "boot-qemu" doesn't conform to snake_case naming style (invalid-name) Signed-off-by: Nathan Chancellor <nathan@kernel.org>
c0386b4 to
5a4005c
Compare
nickdesaulniers
approved these changes
Dec 6, 2022
nickdesaulniers
left a comment
Member
There was a problem hiding this comment.
LGTM; minor questions about the behavior wrt. failure to launch gdb, but I suspect if we quit out of gdb, that might interfere with any Check.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
5a4005c to
3da9dd2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See the individual commits for the warnings.
Depends on ClangBuiltLinux/actions-workflows#4.