Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lorenzwalthert/precommit
pre-commit hooks for R projects
https://github.com/lorenzwalthert/precommit
git hooks pre-commit vcs workflow
Last synced: 7 days ago
JSON representation
pre-commit hooks for R projects
- Host: GitHub
- URL: https://github.com/lorenzwalthert/precommit
- Owner: lorenzwalthert
- License: gpl-3.0
- Created: 2019-05-12T23:11:07.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-11T18:10:35.000Z (14 days ago)
- Last Synced: 2025-01-12T06:01:47.305Z (14 days ago)
- Topics: git, hooks, pre-commit, vcs, workflow
- Language: R
- Homepage: https://lorenzwalthert.github.io/precommit/
- Size: 3.76 MB
- Stars: 254
- Watchers: 4
- Forks: 48
- Open Issues: 35
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
- jimsghstars - lorenzwalthert/precommit - pre-commit hooks for R projects (R)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
fig.path = "man/figures/",
eval = FALSE
)
```# Useful git pre-commit hooks for R
[![CRAN status](https://www.r-pkg.org/badges/version/precommit)](https://CRAN.R-project.org/package=precommit) [![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) [![R build status](https://github.com/lorenzwalthert/precommit/workflows/R-CMD-check/badge.svg)](https://github.com/lorenzwalthert/precommit/actions)
[Pre-commit hooks](https://pre-commit.com) are tests that run each time you attempt to commit. If the tests pass, the commit will be made, otherwise not. A very basic test is to check if the code is parsable, making sure you have not forgotten a comma, brace or quote. You can run hooks locally and/or in the cloud:
- As a check before local commits: This requires installing pre-commit.
- As a CI check with : If you want to enforce passing hooks on pull requests (and auto-fix trivial problems like styling) even if the committer does not have a local installation.
## Goals of the package
The goal of this package is to twofold:
- Provide a [set of hooks](https://lorenzwalthert.github.io/precommit/articles/available-hooks.html) that are useful when your git repo contains R code.
- Provide [usethis](https://github.com/r-lib/usethis)-like functionality for common tasks such as installation and set-up and config file modification.
## Why do I need pre-commit hooks?
By Mara AverickFor a more in-depth explanation and even more reasons, see `vignette("why-use-hooks")`.
## Documentation
The following online docs are available:
- [latest CRAN release](https://lorenzwalthert.github.io/precommit/).
- [GitHub development version](https://lorenzwalthert.github.io/precommit/dev/).
- [UseR 2022 talk on pre-commit for R](https://www.youtube.com/watch?v=r3QXwfxQBLM&t=1280s)
These only cover the functionality added on top of the pre-commit framework by this package. Everything else is covered in the extensive [online documentation](https://pre-commit.com) of the pre-commit framework itself, including how to create hooks for actions like `git push` or `git checkout`, create local hooks etc.