MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / run_hook

Function run_hook

pre_commit/languages/julia.py:21–46  ·  view source on GitHub ↗
(
        prefix: Prefix,
        entry: str,
        args: Sequence[str],
        file_args: Sequence[str],
        *,
        is_local: bool,
        require_serial: bool,
        color: bool,
)

Source from the content-addressed store, hash-verified

19
20
21def run_hook(
22 prefix: Prefix,
23 entry: str,
24 args: Sequence[str],
25 file_args: Sequence[str],
26 *,
27 is_local: bool,
28 require_serial: bool,
29 color: bool,
30) -> tuple[int, bytes]:
31 # `entry` is a (hook-repo relative) file followed by (optional) args, e.g.
32 # `bin/id.jl` or `bin/hook.jl --arg1 --arg2` so we
33 # 1) shell parse it and join with args with hook_cmd
34 # 2) prepend the hooks prefix path to the first argument (the file), unless
35 # it is a local script
36 # 3) prepend `julia` as the interpreter
37
38 cmd = lang_base.hook_cmd(entry, args)
39 script = cmd[0] if is_local else prefix.path(cmd[0])
40 cmd = ('julia', '--startup-file=no', script, *cmd[1:])
41 return lang_base.run_xargs(
42 cmd,
43 file_args,
44 require_serial=require_serial,
45 color=color,
46 )
47
48
49def get_env_patch(target_dir: str, version: str) -> PatchesT:

Callers

nothing calls this directly

Calls 1

pathMethod · 0.80

Tested by

no test coverage detected