{"id":22779805,"url":"https://github.com/gusto/committer","last_synced_at":"2025-04-15T14:22:32.600Z","repository":{"id":24934198,"uuid":"102033961","full_name":"Gusto/committer","owner":"Gusto","description":"A CLI for managing linter executions in git hooks","archived":false,"fork":false,"pushed_at":"2024-11-14T16:54:22.000Z","size":2657,"stargazers_count":24,"open_issues_count":3,"forks_count":2,"subscribers_count":289,"default_branch":"main","last_synced_at":"2025-04-11T21:54:35.667Z","etag":null,"topics":["cli","dex","golang","staticanalysis"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gusto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-31T18:49:46.000Z","updated_at":"2025-04-08T10:05:52.000Z","dependencies_parsed_at":"2024-06-19T05:16:05.231Z","dependency_job_id":"4eeb347a-261f-4576-971d-e6042c0c994d","html_url":"https://github.com/Gusto/committer","commit_stats":{"total_commits":58,"total_committers":17,"mean_commits":3.411764705882353,"dds":0.3793103448275862,"last_synced_commit":"85b456a20bc3a9ad87b0d462ecee5b0ae3d5e6ea"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gusto%2Fcommitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gusto%2Fcommitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gusto%2Fcommitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gusto%2Fcommitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gusto","download_url":"https://codeload.github.com/Gusto/committer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249085974,"owners_count":21210380,"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","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":["cli","dex","golang","staticanalysis"],"created_at":"2024-12-11T20:09:54.504Z","updated_at":"2025-04-15T14:22:32.571Z","avatar_url":"https://github.com/Gusto.png","language":"Go","readme":"# ================= DEPRECATED =================\n\n### Gusto has standardized on using [Lefthook](https://github.com/evilmartians/lefthook) to manage git hooks.\n\n# ================= DEPRECATED =================\n\n# Committer\n\nCommitter is a parallel runner for running static analysis in a git hook created. It supports:\n- Feeding in only the relevant changed files to the analysis commands\n- Running in \"fix\" mode, and automatically correcting files before commit\n  - By default, the files will automatically be staged to be included in the commit\n  - An environment variable can be set to always stop the pre-commit hook if there are changes to be staged manually\n- Running any number of static analysis tools in parallel\n- Helpful display of what was changed before the commit goes through\n\n## Installation\nYou can run the install script by executing:\n```bash\nbash \u003c(curl -s https://raw.githubusercontent.com/Gusto/committer/master/configure.sh)\n```\nThis will:\n- Add `committer` to `/usr/local/bin`\n- Create a basic `committer.yml` in your current working directory to run Rubocop\n- Setup your `.git/hooks/pre-commit` to run committer, if it is not already present\n\nYou can also build it from source by cloning this repository and running `go build committer.go`.\n\n## Configuration\n\nCommitter is fed a YAML file that describes how it should run. There is an example of such file [here](https://github.com/Gusto/committer/blob/master/committer.yml). By default, it will look for a `committer.yml` in the current working directory.\n\n### Structure\n\nThere is a required top level `tasks` key, containing an array of Task objects.\n\n- `name`: Used to describe the task and provide a title for the output.\n- `command`: The command to run when executing the linter. This command should be able to receive a list of files as an argument.\n- `files`: A Regex describing the type of files that should be fed into this command.\n- `excludefilenames`: Set this to true if the command should not receive the list of changed files (i.e. it is intended to run on the whole repo).\n- `fix` (Optional)\n  - `command`: The command to auto-correct violations. If this is specified, committer will attempt to fix and stage your files.\n  - `output`: A Regex to pull the relevant fixed output for display before committing.\n\n## Running\n\nCommitter is most often run as a pre-commit hook. A typical configuration would be to have the following in your `.git/hooks/pre-commit` script:\n\n```bash\n#!/usr/bin/env bash\ncommitter --fix\n```\n\n## Releasing and deploying a new committer version\n\n#### Release\n\n1. Make your changes on a branch.\n2. Update `VERSION` in `committer.go` to new version number.\n3. Once landed in origin/main, add a new version tag to the branch:\n```shell\ngit fetch \u0026\u0026 git checkout main \u0026\u0026 git pull\ngit tag --annotate \"vNEW.VERSION.HERE\"\ngit push --follow-tags\n```\n4. `.github/workflows/publish.yml` will generate a new release for your tag. Follow the action in said tab.\n\n5. The `v` is important.\n\n#### Deploy\n\n1. Gusto engineers may [go/deploy-committer-with-cpe-chef](https://go/deploy-committer-with-cpe-chef).\n\n## Autofix\n\nCommitter can auto-fix everything by default. set `export COMMITTER_AUTO_FIX=true # or 1, T, t` in your\n`~/.profile` or equivalent dotfile.\n\n## Opting out of automatic staging\n\nCommitter will stage auto-corrected files by default. In order to always leave auto-corrected files unstaged for manual staging, set `export COMMITTER_SKIP_STAGE=1` in your `~/.bashrc` or equivalent.\n\n\n## Best-practices\n### Purely Functional Pre-Commit Hooks\nCustom git pre-commit hooks should, as much as possible, be \"pure functions\" that simply reject / accept changes without side effects. Pre-commit hooks by default should perform no\n- Intermediate stashing\n- `git add`'ing\n- Autocorrection\n- etc\n\nThe recommended workflow:\n1. `git add` your code\n2. `git commit`\n3. See the pre-commit hook failure\n4. Manually run `committer --fix`\n5. Redo `git add` and `git commit`.\n\nWe originally performed autocorrection and other modification but there were a lot of random difficult-to-debug side effects that emerged. As we add more steps the possibility for interference grows n^2 (any step can potentially interfere with any other step). Moving to a \"purely functional\" pre-commit hook model lets us easily add additional steps.\n\n### No Composition\nSteps defined by `committer.yml` should be completely independent. Steps have no guaranteed order, and are not intended to be composable.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgusto%2Fcommitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgusto%2Fcommitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgusto%2Fcommitter/lists"}