{"id":32203624,"url":"https://github.com/alexym1/captain","last_synced_at":"2025-10-22T04:44:00.248Z","repository":{"id":287706728,"uuid":"882043144","full_name":"alexym1/captain","owner":"alexym1","description":"Running 'git' Pre-Commit Hooks","archived":false,"fork":false,"pushed_at":"2025-09-30T17:34:10.000Z","size":2955,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T04:43:48.887Z","etag":null,"topics":["precommit","precommit-hooks","r"],"latest_commit_sha":null,"homepage":"https://alexym1.github.io/captain/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexym1.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS.txt","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-01T19:00:29.000Z","updated_at":"2025-09-30T17:31:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ad8b049-e164-41b4-9c6a-880b08749f71","html_url":"https://github.com/alexym1/captain","commit_stats":null,"previous_names":["alexym1/rprecommit","alexym1/captain"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/alexym1/captain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexym1%2Fcaptain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexym1%2Fcaptain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexym1%2Fcaptain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexym1%2Fcaptain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexym1","download_url":"https://codeload.github.com/alexym1/captain/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexym1%2Fcaptain/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280382975,"owners_count":26321423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["precommit","precommit-hooks","r"],"created_at":"2025-10-22T04:43:54.867Z","updated_at":"2025-10-22T04:44:00.243Z","avatar_url":"https://github.com/alexym1.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\r\noutput: github_document\r\nalways_allow_html: true\r\n---\r\n\r\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\r\n\r\n```{r, include = FALSE}\r\nknitr::opts_chunk$set(\r\n  collapse = TRUE,\r\n  comment = \"#\u003e\",\r\n  fig.path = \"man/figures/README-\",\r\n  out.width = \"100%\"\r\n)\r\n```\r\n\r\n# captain \u003ca href=#\u003e\u003cimg src=\"man/figures/sticker.png\" align=\"right\" height=\"139\" style=\"float:right; height:139px;\"\u003e\u003c/a\u003e\r\n\r\n\u003c!-- badges: start --\u003e\r\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/captain)](https://cran.r-project.org/package=captain)\r\n[![](https://cranlogs.r-pkg.org/badges/captain)](https://cran.r-project.org/package=captain)\r\n![](https://img.shields.io/badge/github%20version-1.1.1-orange.svg)\r\n[![R-CMD-check](https://github.com/alexym1/captain/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/alexym1/captain/actions/workflows/R-CMD-check.yaml)\r\n[![Codecov test coverage](https://codecov.io/gh/alexym1/captain/branch/master/graph/badge.svg)](https://app.codecov.io/gh/alexym1/captain?branch=master)\r\n\u003c!-- badges: end --\u003e\r\n\r\n\u003e Running R pre-commit hooks\r\n\r\n\r\n## Overview\r\n\r\nPre-commit hooks are scripts that run automatically before a commit is finalized in Git. They’re used to catch issues early by enforcing checks like code formatting, linting, or running tests before changes are committed.\r\n\r\n`captain` (hook) is a package that allows you to run git pre-commit hooks in a R environment.\r\n\r\n\r\n## Installation\r\n\r\nThe `captain` package can be installed from CRAN as follows:\r\n\r\n```{r eval = FALSE}\r\ninstall.packages(\"captain\")\r\n```\r\n\r\nThe latest version can be installed from GitHub as follows: \r\n\r\n```{r eval = FALSE}\r\n# install.packages(\"pak\")\r\npak::pak(\"alexym1/captain\")\r\n```\r\n\r\n\r\n## Usage\r\n\r\n### Initialize pre-commit framework\r\n\r\n```{r eval = FALSE}\r\ncaptain::install_precommit()\r\n```\r\n\r\n\r\n### Run hooks\r\n\r\n```{r eval = FALSE}\r\ncaptain::run_precommit()\r\n```\r\n\r\n\r\n### Add hooks \r\n\r\nEditing the `.pre-commit-config` file using `captain::edit_precommit_config()`:\r\n\r\n```{bash eval = FALSE}\r\nrepos:\r\n  - repo: local\r\n    hooks:\r\n      - id: renv\r\n        name: Synchronize project from renv.lock\r\n        description: Synchronize the project from the renv.lock\r\n        entry: Rscript inst/pre-commit/hooks/synchronize_project.R\r\n        language: system\r\n        pass_filenames: false\r\n```\r\n\r\n\r\n## Code of conduct\r\n\r\nPlease note that this project is released with a [Contributor Code of Conduct](https://alexym1.github.io/captain/CONTRIBUTING.html). By participating in this project you agree to abide by its terms.\r\n\r\n\r\n## Acknowledgments\r\n\r\nThis logo was created by [@obstacle.graphic](https://linktr.ee/obstacle.graphic).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexym1%2Fcaptain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexym1%2Fcaptain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexym1%2Fcaptain/lists"}