The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Type: Package
Title: Running 'git' Pre-Commit Hooks
Version: 1.1.1
Description: Git hook scripts are useful for identifying simple issues before submission to code review. 'captain' (hook) is an R package to manage and run git pre-commit hooks.
License: MIT + file LICENSE
URL: https://github.com/alexym1/captain, https://alexym1.github.io/captain/
BugReports: https://github.com/alexym1/captain/issues
Depends: R (≥ 4.1.0)
Imports: cli, fs, yaml
Suggests: devtools, covr, knitr, styler, testthat, withr
VignetteBuilder: knitr
Encoding: UTF-8
RoxygenNote: 7.3.3
NeedsCompilation: no
Packaged: 2025-09-22 20:22:11 UTC; Admin
Author: Alex Yahiaoui Martinez ORCID iD [aut, cre]
Maintainer: Alex Yahiaoui Martinez <yahiaoui-martinez.alex@outlook.com>
Repository: CRAN
Date/Publication: 2025-09-30 07:20:18 UTC

Handle .pre-commit-config file

Description

Handle .pre-commit-config file for running pre-commit hooks

Usage

create_precommit_config(filename = path_precommit_files()[1], force = FALSE)

edit_precommit_config()

Arguments

filename

the name of the file to create

force

overwrite the file if it already exists

Details

create_precommit_config() will create a .pre-commit-config file in the current project. Only one file is allowed in the project and should be in the root directory or in the inst directory such as:

Value

cli messages related to the creation and edition of the .pre-commit-config file.


Create pre-commit hooks

Description

Add pre-commit hooks to .pre-commit-config.y*ml file

Usage

create_precommit_hook(
  filename,
  id,
  name,
  description,
  language = "system",
  always_run = TRUE
)

Arguments

filename

The name of script file

id

The unique identifier for the hook

name

A descriptive name for the hook

description

A brief description of what the hook does

language

The programming language or environment for the hook (default is "system")

always_run

Logical, whether the hook should always run (default is TRUE)

Value

cli messages related to the creation of the hook and updating the config file. Create ⁠inst/pre-commit/hooks/{filename}.R⁠ script and update .pre-commit-config.y*ml file.


Install pre-commit

Description

Install pre-commit file in the repo.

Usage

install_precommit(force = FALSE, ...)

Arguments

force

overwrite the file if it already exists

...

additional arguments to pass to create_precommit_config()

Value

cli messages related to the installation of pre-commit files. Create inst/pre-commit folder and .git/hooks/pre-commit file.


Run precommit

Description

Run pre-commit hooks

Usage

run_precommit(path = ".git/hooks/pre-commit")

Arguments

path

path of the pre-commit file

Value

cli message related to the run of all git precommit hooks.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.