Framework for Python

Git

git_hooks_enable()

Turn on one hook check in the settings and (re)install the hook.

Usage

git_hooks_enable(
    hook_name: str,
    settings_file: str | Path | None = None,
    *,
    verbose: bool = True,
) -> bool

Arguments

Name Type Default Description
hook_name required str

The check. One of "data_security", "check_sensitive_dirs", or "check_notebook_outputs". The older name "warn_unignored_sensitive" is accepted for "check_sensitive_dirs".

settings_file str | Path | None None

The project's settings file. Default: the settings.yml or config.yml found from the current directory.

verbose bool True

Print what was done.

Value

Whether the hook is installed.

Raises

  • ValueError: When hook_name is not a known check, including the removed "ai_sync".
  • FrameworkError: When the settings file is not found.