Use bundler for RuboCop
Closed this issue · 11 comments
In my project, we've locked to a specific version of RuboCop in the Gemfile, but pre-commit doesn't seem to respect that.
this is complicated problem as we do not know if the hook will be run with the same ruby as in your project, would it be viable option if we would give you an option to set the gem version to load?
I have the same concern as @jgarber. Also I don't like that we are grabbing the default ruby from RVM.
Can we provide bundler as one of the installer templates maybe. So instead of automatic, manual templates we can have bundler, rvm/rbenv?
To support something like this we might have to change the rubocop check to shell out and use bundler:
bundle exec rubocop
We want the pre-commit check to run quickly as blocks the act of committing. Even a 1 second run time is enough to deter some users from using it =/
we could add rubocop_bundled
and it would be really slow ... but I just thought we could read in Gemfile.lock
and check version of rubocop
to load - would that be an option? (not sure how easy it would be - it would require latest rubygems-2.2+
or bundler
)
closing as there was no feedback in two months, for details see https://github.com/jish/pre-commit/blob/master/CONTRIBUTING.md#closing-old-issues
I'd like to re-open this issue; I'm having the same problem as the original poster.
@m1foley try using your project ruby, here are some instructions that might help: https://github.com/jish/pre-commit#rvm
Thanks, but that doesn't work for me. I use rbenv + Bundler.
@m1foley the instructions to set custom ruby are the same for any kind of ruby, ruby manager ... or anything you want to use, please refer your tool documentation for instructions how to use ruby of your choosing.
when you get a proper command working please either open a PR to add it to readme or share it with us so we can add it.
I've found a way to do it and added a PR. Thanks for your help & patience.