setters#

remove_precommit_hook(precommit: ModifiablePrecommit, hook_id: str, repo_url: str | None = None) None[source]#
update_single_hook_precommit_repo(precommit: ModifiablePrecommit, expected: Repo) None[source]#

Update the repo definition in .pre-commit-config.yaml.

If the repository is not yet listed under the repos key, a new entry will be automatically inserted. If the repository exists, but the definition is not the same as expected, the entry in the YAML config will be updated.

update_precommit_hook(precommit: ModifiablePrecommit, repo_url: str, expected_hook: Hook) None[source]#

Update the pre-commit hook definition of a specific pre-commit repo.

This function updates the .pre-commit-config.yaml file, but does this only for a specific hook definition within a pre-commit repository definition.