Switch to using run_process() instead of execute() in rbtools.hooks

Review Request #13426 — Created Nov. 21, 2023 and updated

Information

RBTools
release-5.x

Reviewers

Since we're deprecating the rbtools.hooks.common.execute(), this change
switches over to using rbtools.utils.process.run_process() instead in our
rbtools.hooks module.

Ran the git-hook-check-approval hook, saw that it worked correctly.

Summary ID
Switch to using run_process() instead of execute() in rbtools.hooks
17b5dc1e79fa07890c8abea53346952d7fdf3c55
Description From Last Updated

A good pattern for these more complex statements (especially when they span lines) is to chain them: branches = ( …

chipx86chipx86

Along the lines of my older comment, I think for all run_process() calls, we should use the chain form. This …

chipx86chipx86
chipx86
  1. 
      
  2. 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.

  3. 
      
maubin
david
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. 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.

  3. 
      
maubin
Review request changed

Commits:

Summary ID
Switch to using run_process() instead of execute() in rbtools.hooks
a43dd220003a017d91418ae46ead7384c246d8cc
Switch to using run_process() instead of execute() in rbtools.hooks
17b5dc1e79fa07890c8abea53346952d7fdf3c55

Diff:

Revision 3 (+80 -12)

Show changes

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
david
  1. Ship It!
  2. 
      
chipx86
  1. Ship It!
  2. 
      
Loading...