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

Function modify_config

testing/fixtures.py:69–80  ·  view source on GitHub ↗

Modify the config yielded by this context to write to .pre-commit-config.yaml

(path='.', commit=True)

Source from the content-addressed store, hash-verified

67
68@contextlib.contextmanager
69def modify_config(path='.', commit=True):
70 """Modify the config yielded by this context to write to
71 .pre-commit-config.yaml
72 """
73 config_path = os.path.join(path, C.CONFIG_FILE)
74 with open(config_path) as f:
75 config = yaml_load(f.read())
76 yield config
77 with open(config_path, 'w', encoding='UTF-8') as config_file:
78 config_file.write(yaml_dump(config))
79 if commit:
80 git_commit(msg=modify_config.__name__, cwd=path)
81
82
83def sample_local_config():

Callers 13

aliased_repoFunction · 0.90
test_always_runFunction · 0.90
test_lots_of_filesFunction · 0.90
modified_config_repoFunction · 0.90
test_pass_filenamesFunction · 0.90
test_fail_fastFunction · 0.90
test_fail_fast_per_hookFunction · 0.90

Calls 2

yaml_dumpFunction · 0.90
git_commitFunction · 0.90

Tested by 13

aliased_repoFunction · 0.72
test_always_runFunction · 0.72
test_lots_of_filesFunction · 0.72
modified_config_repoFunction · 0.72
test_pass_filenamesFunction · 0.72
test_fail_fastFunction · 0.72
test_fail_fast_per_hookFunction · 0.72