Switch to using run_process() instead of execute() in rbtools.hooks
Review Request #13426 — Created Nov. 21, 2023 and submitted
Since we're deprecating the
rbtools.hooks.common.execute()
, this change
switches over to usingrbtools.utils.process.run_process()
instead in our
rbtools.hooks
module.
Ran the
git-hook-check-approval
hook, saw that it worked correctly.
Summary | ID |
---|---|
17b5dc1e79fa07890c8abea53346952d7fdf3c55 |
-
-
rbtools/hooks/git.py (Diff revision 1) A good pattern for these more complex statements (especially when they span lines) is to chain them:
branches = ( run_process(git_command) .stdout .read() .replace('*', '') .split('\n') )
This is what the other call sites all use.
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+36 -12) |
Checks run (2 succeeded)
flake8
passed.
JSHint
passed.
-
-
rbtools/hooks/git.py (Diff revision 2) Along the lines of my older comment, I think for all
run_process()
calls, we should use the chain form. This is a bit more readable and easier to augment.
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+80 -12) |
Checks run (2 succeeded)
flake8
passed.
JSHint
passed.