I would like to enable the Rubocop checker with Syntastic. I have set it has a checker and given the path to the executable. Although :SyntasticInfo
reports that it is not an active checker. Also :SyntasticCheck rubocop
reports that rubocop is not an available checker.
Are there any other settings I need? Could this be caused by the warning messages given by rubocop --version
?
.vimrc settings
let g:syntastic_ruby_checkers = ['rubocop', 'mri']
let g:syntastic_ruby_rubocop_exec = '/Users/jjasonclark/.rbenv/shims/rubocop'
rubocop warning messages
warning: parser/current is loading parser/ruby21, which recognizes
warning: 2.1.5-compliant syntax, but you are running 2.1.2.
0.26.0
Edit: Based on comments I have discovered a partial workaround. The RBENV shim can be called with a command line parameter to specify the Ruby version. This works for running the command manually, but it doesn't work for the Syntastic plugin. My guess is it doesn't work because of the warning messages from Rubocop about the parser version.
let g:syntastic_ruby_rubocop_exec = 'RBENV_VERSION=2.1.2 /Users/jjasonclark/.rbenv/shims/rubocop'
Edit: I installed Ruby 2.1.5 and updated the RBENV_VERSION
value to successfully remove the warning message. This still does not enable Rubocop for Syntastic. :SyntasticCheck rubocop
still reports syntastic: warning: checker rubocop is not available
Syntastic is loading the wrong version of Ruby. From your command line, enter
ruby -v && which ruby
.Now, change the second line of the settings to:
Using whatever paths
which ruby
andwhich rubocop
show you.