diff options
author | David Duarte <licorne@google.com> | 2023-04-24 23:17:12 +0000 |
---|---|---|
committer | William Escande <wescande@google.com> | 2023-05-01 15:58:28 -0700 |
commit | 958d01176166cce29564cc3a2ef1e03db8159827 (patch) | |
tree | d8a3d163d0d3474506f3004d87833cfa71d84b4a | |
parent | 203262a7e7672d002db1c26d45a9a8658c6fe583 (diff) | |
download | repohooks-958d01176166cce29564cc3a2ef1e03db8159827.tar.gz |
ktfmt: Use tool args in fixup command
Change-Id: Ib73a63925ef38c5102ab50a92f2ef3f9b3c6fa84
Test: manual
-rw-r--r-- | rh/hooks.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/rh/hooks.py b/rh/hooks.py index acf72af..47c3adb 100644 --- a/rh/hooks.py +++ b/rh/hooks.py @@ -439,12 +439,13 @@ def check_ktfmt(project, commit, _desc, diff, options=None): result = _run(cmd) if result.stdout: paths = [os.path.join(project.dir, x.file) for x in filtered] + fixup_cmd = [ktfmt] + args + paths error = ( - f'\nKotlin files need formatting.\n' - 'To reformat the kotlin files in this commit:\n' - f'{ktfmt} {" ".join(paths)}' + '\nKotlin files need formatting.\n' + + 'To reformat the kotlin files in this commit:\n' + + rh.shell.cmd_to_str(fixup_cmd) ) - fixup_func = _fixup_func_caller([ktfmt] + paths) + fixup_func = _fixup_func_caller(fixup_cmd) return [rh.results.HookResult('ktfmt', project, commit, error=error, files=paths, fixup_func=fixup_func)] return None |