-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
syntax-checker configuration for bundler #3726
Comments
You can provide the path to rubocop by using SPC-e-S or flycheck-set-checker-executable. Then you select which checker you want to configure (rubocop), then you provide the full path to rubocop's executable. |
@rashkov is there a way to configure it to use rbenv's shims? Even if I point |
@asymmetric Not sure what the problem could be as I'm also using rbenv, and also pointing it to ~/.rbenv/shims/rubocop. Maybe you can try running rbenv rehash and then try again with spacemacs. Also make sure that you can invoke rubocop from the command-line against a ruby file and see that it works properly. |
@rashkov how are you making spacemacs aware of rbenv? I have One more question: where have you installed your gems? I have them local to the project (i.e. I passed the And yes, rubocop is available straight from the shell. Thanks! |
@asymmetric: I actually never made spacemacs aware of rbenv, it has always worked out of the box. In fact, I just turned off rbenv and tested out spacemacs, and rubocop still works when I point spacemacs to ~/.rbenv/shims/rubocop I turned off rbenv by exporting my PATH without the rbenv directories. Running which ruby now pointed to my system ruby instead or rbenv's ruby. Then I launched spacemacs from that shell, pointed flycheck's rubocop to the wrong executable to "break it", then pointed it back to ~/.rbenv/shims/rubocop, and after editing the file a little and saving it rubocop woke up and started working again. My gems are all installed to ~/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems Also this comes to mind: recently my rbenv broke on another computer, and I had to delete (or move) the ~/.gems directory. The gems in that folder were interfering with rbenv. That might be something to try as well |
I see. The difference between my setup and yours is that my rubocop is installed via bundler, so flycheck would need to run I suspect the solution involves implementing a function to pass to |
Just realized that this entire github issue is about bundle exec, my bad. I've totally ignored that aspect. Yes, flycheck-command-wrapper-function definitely appears to be the right place to fix this. Wish I could help with that but I would also need to pick up some elisp before that happens. |
👍 I've recently switched over to Spacemacs and would love to see this one fixed. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
After trying a bunch of things with flycheck-command-wrapper, I realised that there's a much simpler solution!
Emacs will now use your wrapper script in ~/bin/rubocop, thereby running rubocop with |
I'm just starting out with Spacemacs and the Flycheck plugin seems to be unable to correctly guess my path to RuboCop. I'm pretty sure Flycheck allows wrapping a command through its API but I'm just starting out with Emacs Lisp and am a little confused about how to configure Flycheck to use
bundle exec
for RuboCop. Do I need to define an entirely new checker? Can I just specify the check name and the command I want to wrap the check call with?http://www.flycheck.org/manual/latest/Flycheck-hooks.html
flycheck/flycheck#752 (comment)
The text was updated successfully, but these errors were encountered: