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

Function _uninstall_hook_script

pre_commit/commands/install_uninstall.py:149–161  ·  view source on GitHub ↗
(hook_type: str)

Source from the content-addressed store, hash-verified

147
148
149def _uninstall_hook_script(hook_type: str) -> None:
150 hook_path, legacy_path = _hook_paths(hook_type)
151
152 # If our file doesn't exist or it isn't ours, gtfo.
153 if not os.path.exists(hook_path) or not is_our_script(hook_path):
154 return
155
156 os.remove(hook_path)
157 output.write_line(f'{hook_type} uninstalled')
158
159 if os.path.exists(legacy_path):
160 os.replace(legacy_path, hook_path)
161 output.write_line(f'Restored previous hooks to {hook_path}')
162
163
164def uninstall(config_file: str, hook_types: list[str] | None) -> int:

Callers 1

uninstallFunction · 0.85

Calls 3

_hook_pathsFunction · 0.85
is_our_scriptFunction · 0.85
existsMethod · 0.80

Tested by

no test coverage detected