{"action":"created","issue":{"url":"https://api.github.com/repos/jish/pre-commit/issues/235","repository_url":"https://api.github.com/repos/jish/pre-commit","labels_url":"https://api.github.com/repos/jish/pre-commit/issues/235/labels{/name}","comments_url":"https://api.github.com/repos/jish/pre-commit/issues/235/comments","events_url":"https://api.github.com/repos/jish/pre-commit/issues/235/events","html_url":"https://github.com/jish/pre-commit/issues/235","id":130891177,"number":235,"title":"Cannot get pre-commit hook to prevent commit creation","user":{"login":"trystant","id":13509,"avatar_url":"https://avatars.githubusercontent.com/u/13509?v=3","gravatar_id":"","url":"https://api.github.com/users/trystant","html_url":"https://github.com/trystant","followers_url":"https://api.github.com/users/trystant/followers","following_url":"https://api.github.com/users/trystant/following{/other_user}","gists_url":"https://api.github.com/users/trystant/gists{/gist_id}","starred_url":"https://api.github.com/users/trystant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trystant/subscriptions","organizations_url":"https://api.github.com/users/trystant/orgs","repos_url":"https://api.github.com/users/trystant/repos","events_url":"https://api.github.com/users/trystant/events{/privacy}","received_events_url":"https://api.github.com/users/trystant/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-03T02:33:53Z","updated_at":"2016-02-03T06:42:52Z","closed_at":null,"body":"Hi,\r\n\r\nI just found this gem, installed it in my repo, but with the following settings in place (taken from the home page), the pre-commit hook will not prevent bad ruby code from being run.\r\n\r\nMy only aim is to have the test suite run in order to guarantee that all tests pass before committing to the repo.\r\n\r\nHere is the output of my `pre-commit list`\r\n\r\n```\r\nAvailable providers: default(0) git(10) git_old(11) yaml(20) env(30)\r\nAvailable checks   : before_all ci closure coffeelint common console_log csslint debugger gemfile_path go jshint jslint json local merge_conflict migration nb_space pry rails rspec_focus rubocop ruby ruby_symbol_hashrockets scss_lint tabs whitespace yaml\r\nDefault   checks   : common rails\r\nEnabled   checks   : common rails\r\nEvaluated checks   : tabs nb_space whitespace merge_conflict debugger pry local jshint console_log migration\r\nDefault   warnings :\r\nEnabled   warnings :\r\nEvaluated warnings :\r\n```\r\n\r\nand the `.git/hooks/pre-commit` file:\r\n\r\n```\r\n#!/usr/bin/env sh\r\n\r\n# This hook has a focus on portability.\r\n# This hook will attempt to setup your environment before running checks.\r\n#\r\n# If you would like `pre-commit` to get out of your way and you are comfortable\r\n# setting up your own environment, you can install the manual hook using:\r\n#\r\n#     pre-commit install --manual\r\n#\r\n\r\n# This is a work-around to get GitHub for Mac to be able to run `node` commands\r\n# https://stackoverflow.com/questions/12881975/git-pre-commit-hook-failing-in-github-for-mac-works-on-command-line\r\nPATH=$PATH:/usr/local/bin:/usr/local/sbin\r\n\r\n\r\ncmd=`git config pre-commit.ruby 2>/dev/null`\r\nif   test -n \"${cmd}\"\r\nthen true\r\nelif which rvm   >/dev/null 2>/dev/null\r\nthen cmd=\"rvm default do ruby\"\r\nelif which rbenv >/dev/null 2>/dev/null\r\nthen cmd=\"rbenv exec ruby\"\r\nelse cmd=\"ruby\"\r\nfi\r\n\r\nexport rvm_silence_path_mismatch_check_flag=1\r\n\r\n${cmd} -rrubygems -e '\r\n  begin\r\n    require \"pre-commit\"\r\n    true\r\n  rescue LoadError => e\r\n    $stderr.puts <<-MESSAGE\r\npre-commit: WARNING: Skipping checks because: #{e}\r\npre-commit: Did you set your Ruby version?\r\nMESSAGE\r\n    false\r\n  end and PreCommit.run\r\n'\r\n```\r\n\r\nIf there's more info I need to add, please let me know. Also, any assistance would be appreciated. Thanks much"},"comment":{"url":"https://api.github.com/repos/jish/pre-commit/issues/comments/179042052","html_url":"https://github.com/jish/pre-commit/issues/235#issuecomment-179042052","issue_url":"https://api.github.com/repos/jish/pre-commit/issues/235","id":179042052,"user":{"login":"jish","id":1817,"avatar_url":"https://avatars.githubusercontent.com/u/1817?v=3","gravatar_id":"","url":"https://api.github.com/users/jish","html_url":"https://github.com/jish","followers_url":"https://api.github.com/users/jish/followers","following_url":"https://api.github.com/users/jish/following{/other_user}","gists_url":"https://api.github.com/users/jish/gists{/gist_id}","starred_url":"https://api.github.com/users/jish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jish/subscriptions","organizations_url":"https://api.github.com/users/jish/orgs","repos_url":"https://api.github.com/users/jish/repos","events_url":"https://api.github.com/users/jish/events{/privacy}","received_events_url":"https://api.github.com/users/jish/received_events","type":"User","site_admin":false},"created_at":"2016-02-03T06:42:52Z","updated_at":"2016-02-03T06:42:52Z","body":"Hello,\r\n\r\nYou should be able to run this command to disable the `common` checks and the `rails` checks:\r\n\r\n    $ pre-commit disable git checks common rails\r\n\r\nThen you can enable the `ci` check using:\r\n\r\n    $ pre-commit enable git checks ci\r\n\r\nFYI The `ci` check will not do anything unless you have a Rake task defined called `pre_commit:ci`. You can point the `pre_commit:ci` task at whatever Rake task you want like this:\r\n\r\nhttps://jish.github.io/pre-commit/checks/ci/\r\n\r\n    namespace :pre_commit do\r\n      task :ci => [:test]\r\n    end"}}