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

Function make_config_from_repo

testing/fixtures.py:99–113  ·  view source on GitHub ↗
(repo_path, rev=None, hooks=None, check=True)

Source from the content-addressed store, hash-verified

97
98
99def make_config_from_repo(repo_path, rev=None, hooks=None, check=True):
100 manifest = load_manifest(os.path.join(repo_path, C.MANIFEST_FILE))
101 config = {
102 'repo': f'file://{repo_path}',
103 'rev': rev or git.head_rev(repo_path),
104 'hooks': hooks or [{'id': hook['id']} for hook in manifest],
105 }
106
107 if check:
108 wrapped = validate({'repos': [config]}, CONFIG_SCHEMA)
109 wrapped = apply_defaults(wrapped, CONFIG_SCHEMA)
110 config, = wrapped['repos']
111 return config
112 else:
113 return config
114
115
116def read_config(directory, config_file=C.CONFIG_FILE):

Calls

no outgoing calls