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

Function _cloned_repository_hooks

pre_commit/repository.py:171–200  ·  view source on GitHub ↗
(
        repo_config: dict[str, Any],
        store: Store,
        root_config: dict[str, Any],
)

Source from the content-addressed store, hash-verified

169
170
171def _cloned_repository_hooks(
172 repo_config: dict[str, Any],
173 store: Store,
174 root_config: dict[str, Any],
175) -> tuple[Hook, ...]:
176 repo, rev = repo_config['repo'], repo_config['rev']
177 manifest_path = os.path.join(store.clone(repo, rev), C.MANIFEST_FILE)
178 by_id = {hook['id']: hook for hook in load_manifest(manifest_path)}
179
180 for hook in repo_config['hooks']:
181 if hook['id'] not in by_id:
182 logger.error(
183 f'`{hook["id"]}` is not present in repository {repo}. '
184 f'Typo? Perhaps it is introduced in a newer version? '
185 f'Often `pre-commit autoupdate` fixes this.',
186 )
187 exit(1)
188
189 hook_dcts = [
190 _hook(by_id[hook['id']], hook, root_config=root_config)
191 for hook in repo_config['hooks']
192 ]
193 return tuple(
194 Hook.create(
195 repo_config['repo'],
196 Prefix(store.clone(repo, rev, hook['additional_dependencies'])),
197 hook,
198 )
199 for hook in hook_dcts
200 )
201
202
203def _repository_hooks(

Callers 1

_repository_hooksFunction · 0.85

Calls 4

PrefixClass · 0.90
_hookFunction · 0.85
cloneMethod · 0.80
createMethod · 0.80

Tested by

no test coverage detected