MCPcopy
hub / github.com/pre-commit/pre-commit / install

Function install

pre_commit/commands/install_uninstall.py:114–141  ·  view source on GitHub ↗
(
        config_file: str,
        store: Store,
        hook_types: list[str] | None,
        overwrite: bool = False,
        hooks: bool = False,
        skip_on_missing_config: bool = False,
        git_dir: str | None = None,
)

Source from the content-addressed store, hash-verified

112
113
114def install(
115 config_file: str,
116 store: Store,
117 hook_types: list[str] | None,
118 overwrite: bool = False,
119 hooks: bool = False,
120 skip_on_missing_config: bool = False,
121 git_dir: str | None = None,
122) -> int:
123 if git_dir is None and git.has_core_hookpaths_set():
124 logger.error(
125 'Cowardly refusing to install hooks with `core.hooksPath` set.\n'
126 'hint: `git config --unset-all core.hooksPath`',
127 )
128 return 1
129
130 for hook_type in _hook_types(config_file, hook_types):
131 _install_hook_script(
132 config_file, hook_type,
133 overwrite=overwrite,
134 skip_on_missing_config=skip_on_missing_config,
135 git_dir=git_dir,
136 )
137
138 if hooks:
139 install_hooks(config_file, store)
140
141 return 0
142
143
144def install_hooks(config_file: str, store: Store) -> int:

Calls 3

_hook_typesFunction · 0.85
_install_hook_scriptFunction · 0.85
install_hooksFunction · 0.85