Generates a custom Git pre-commit hook by interactively prompting the user to select which safety checks should be enforced before allowing a commit.
Value
Invisibly returns a named list with components: status ("done",
"cancelled", or "error"), hook_path, and checks (named logical list).
Details
The function automates the creation of a `.git/hooks/pre-commit` shell script that can enforce the following checks:
Code Styling: Automatically runs `styler::style_pkg()` to standardize formatting and stages the modified files.
Documentation: Automatically runs `devtools::document()` to ensure the `NAMESPACE` and help files are up to date.
Testing: Executes `testthat::test_local()` and aborts the commit if any tests fail.
Warning
This function modifies files on disk or the global environment. Please ensure you have a backup or are using version control (e.g., Git) before execution.
Examples
if (interactive()) {
setup_preflight()
}
