{"id":13835387,"url":"https://github.com/jish/pre-commit","last_synced_at":"2025-05-14T19:02:27.499Z","repository":{"id":678546,"uuid":"1123228","full_name":"jish/pre-commit","owner":"jish","description":"A slightly improved pre-commit hook for git","archived":false,"fork":false,"pushed_at":"2023-10-31T03:28:01.000Z","size":8981,"stargazers_count":797,"open_issues_count":18,"forks_count":96,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-06T07:04:24.435Z","etag":null,"topics":["git","ruby"],"latest_commit_sha":null,"homepage":"https://jish.github.io/pre-commit/","language":"JavaScript","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/jish.png","metadata":{"files":{"readme":"Readme.md","changelog":"changelog.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2010-11-29T20:02:17.000Z","updated_at":"2025-01-28T14:40:11.000Z","dependencies_parsed_at":"2024-01-18T09:57:52.733Z","dependency_job_id":"7415de01-80b4-4b40-bd76-c4d7da5f69d3","html_url":"https://github.com/jish/pre-commit","commit_stats":{"total_commits":631,"total_committers":54,"mean_commits":"11.685185185185185","dds":0.554675118858954,"last_synced_commit":"82baede5178de7abc6cf73777f11af5d7ec98f21"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jish%2Fpre-commit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jish%2Fpre-commit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jish%2Fpre-commit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jish%2Fpre-commit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jish","download_url":"https://codeload.github.com/jish/pre-commit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248703194,"owners_count":21148116,"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":["git","ruby"],"created_at":"2024-08-04T14:01:00.897Z","updated_at":"2025-04-13T10:55:55.646Z","avatar_url":"https://github.com/jish.png","language":"JavaScript","readme":"A better pre-commit hook for git.\n\n[![Current version](https://badge.fury.io/rb/pre-commit.svg)](https://rubygems.org/gems/pre-commit)\n[![Code Climate](https://img.shields.io/codeclimate/github/jish/pre-commit.svg)](https://codeclimate.com/github/jish/pre-commit)\n[![Coverage Status](https://img.shields.io/coveralls/jish/pre-commit/master.svg)](https://coveralls.io/r/jish/pre-commit?branch=master)\n[![Build status](https://travis-ci.org/jish/pre-commit.svg?branch=master)](https://travis-ci.org/jish/pre-commit)\n[![Dependency Status](https://gemnasium.com/jish/pre-commit.png)](https://gemnasium.com/jish/pre-commit)\n[![Documentation](https://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/pre-commit/frames)\n\n## Installation\n\nInstall the gem\n\n    $ gem install pre-commit\n\nUse the pre-commit command to generate a stub pre-commit hook\n\n    # In your git repo\n    $ pre-commit install\n\nThis creates a .git/hooks/pre-commit script which will check your git config and run checks that are enabled.\n\n### Bundler\n\nIf you want to use Bundler to specify a version of RuboCop, add the following to `Gemfile`:\n\n```ruby\ngroup :development do\n  gem \"pre-commit\", require: false\n  gem \"rubocop\", require: false\nend\n```\n\nAnd run the following to run `pre-commit` via Bundler:\n\n```\n$ git config pre-commit.ruby \"bundle exec ruby\"\n```\n\n### RVM\n\nIf you are using rvm you need to install pre-commit into the ```default``` gemset, because it does not use the ```current``` environment\n\n    $ rvm default do gem install pre-commit\n\nAlternatively you can configure pre-commit to use the ```current``` rvm gemset\n\n    $ git config pre-commit.ruby \"rvm `rvm current` do ruby\" # OR:\n    $ git config pre-commit.ruby `rvm wrapper current show ruby` # available in RVM 1.26.12\n\n## Available checks\n\nThese are the available checks:\n\n* white_space\n* console_log\n* debugger\n* pry\n* tabs\n* jshint\n* js_lint\n* php (Runs php -l on all staged files)\n* rspec_focus (Will check if you are about to check in a :focus in a spec file)\n* ruby_symbol_hashrockets (1.9 syntax. BAD :foo =\u003e \"bar\". GOOD foo: \"bar\")\n* local (executes `config/pre-commit.rb` with list of changed files)\n* merge_conflict (Will check if you are about to check in a merge conflict)\n* migrations (Will make sure you check in the proper files after creating a Rails migration)\n* ci (Will run the `pre_commit:ci` rake task and pass or fail accordingly)\n* rubocop (Check ruby code style using the rubocop gem. Rubocop must be installed)\n* before_all (Check your RSpec tests for the use of `before(:all)`)\n* coffeelint (Check your coffeescript files using the [coffeelint gem.](https://github.com/clutchski/coffeelint))\n* gobuild (Runs go build and fails if can't compile)\n* gofmt (Runs go fmt on go source files and fail if formatting is incorrect)\n* scss_lint (Check your SCSS files using the [scss-lint gem](https://github.com/brigade/scss-lint))\n* yaml (Check that your YAML is parsable)\n* json (Checks if JSON is parsable)\n\n## Default checks\n\nUse `pre-commit list` to see the list of default and enabled checks and warnings.\n\n## Enabling / Disabling Checks / Warnings\n\n### Git configuration\n\n    git config pre-commit.checks \"[whitespace, jshint, debugger]\"\n\nTo disable, simply leave one off the list\n\n    git config pre-commit.checks \"[whitespace, jshint]\"\n\n### CLI configuration\n\n```ssh\npre-commit \u003cenable|disable\u003e \u003cgit|yaml\u003e \u003cchecks|warnings\u003e check1 [check2...]\n```\n\nThe `git` provider can be used for local machine configuration, the `yaml` can be used for shared\nproject configuration.\n\nExample move `jshint` from `checks` to `warnings` in `yaml` provider and save configuration to git:\n```bash\npre-commit disable yaml checks   jshint\npre-commit enable  yaml warnings jshint\ngit add config/pre_commit.yml\ngit commit -m \"pre-commit: move jshint from checks to warnings\"\n```\n\nExample `config/pre_commit.yml`:\n```yaml\n---\n:warnings_remove: []\n:warnings_add:\n- :jshint\n- :tabs\n```\n\n## Running test manually\n\nThis functionality was added in version `0.17.0`\n\n```bash\npre-commit run              # run on the files added to index not yet commited\npre-commit run all          # run on all files in current directory\npre-commit run git          # run on all git-tracked files, respect gitignore (added in 0.19.0)\npre-commit run \u003cfile-list\u003e  # run on the list of files, patterns not supported\n```\n\n## Configuration providers\n\n`pre-commit` comes with 4 configuration providers:\n\n- `default` - basic settings, read only\n- `git` - reads configuration from `git config pre-commit.*`, allow local update\n- `yaml` - reads configuration from `/etc/pre_commit.yml`, `$HOME/.pre_commit.yml` and `config/pre_commit.yml`, allows `config/pre_commit.yml` updates\n- `env` - reads configuration from environment variables\n\n## Excluding files from checks\n\n`pre-commit` uses `git` to get list of files to check, you can ignore\nthe list of git files to check with:\n\n1. `.gitignore` - git supported file shared beteen all checkouts\n2. `.git/info/exclude` - git supported file only for this checkout\n3. `.pre_commit.ignore` - `pre-commit` specific list can be shared,\n    [Allowed filters](http://ruby-doc.org/core-2.1.3/File.html#method-c-fnmatch)\n\n## [Contributing](.github/CONTRIBUTING.md)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjish%2Fpre-commit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjish%2Fpre-commit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjish%2Fpre-commit/lists"}