(
repo_config: dict[str, Any],
store: Store,
root_config: dict[str, Any],
)
| 169 | |
| 170 | |
| 171 | def _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 | |
| 203 | def _repository_hooks( |
no test coverage detected