Framework for Python

Git

git_hooks_install()

Install Framework's pre-commit hook when a hook is enabled in the settings.

A pre-commit hook Framework wrote earlier (by R or Python) is replaced. Any other pre-commit hook is kept unless force is True.

Usage

git_hooks_install(
    settings_file: str | Path | None = None,
    *,
    force: bool = False,
    verbose: bool = True,
) -> bool

Arguments

Name Type Default Description
settings_file str | Path | None None

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

force bool False

Replace a pre-commit hook that Framework did not write.

verbose bool True

Print what was done.

Value

Whether the hook was installed. False outside a git repository, when no check is enabled, or when another hook is kept.

Raises

  • FrameworkError: When the settings file is not found.