Skip to main content

splice_hooks_block

Function splice_hooks_block 

Source
pub fn splice_hooks_block(
    existing: Option<&str>,
    block: &str,
) -> Result<String, String>
Expand description

The whole .pre-commit-config.yaml content after splicing the rendered hook block.

A fresh file carries the hook-types key, the repos: key, and the block; a marked file takes the block in place; an unmarked file takes it directly under its repos: line, above the target’s own hooks. An unmarked file with no repos: line is refused by name — the block’s entries are list items and have nowhere honest to go.

§Errors

The reason the block has no place, for the caller’s refusal to carry.