1

I want ruby-rubocop Flycheck syntax checker to execute bundle exec rubocop instead of just rubocop.

What I've tried:

  1. (setq flycheck-ruby-rubocop-executable "bundle exec rubocop")

    Results in following error:

    Error while checking syntax automatically: (error "Output file descriptor of flycheck-ruby-rubocop is closed")
    
  2. (flycheck-set-checker-executable 'ruby-rubocop "bundle exec rubocop")

    I get error:

    user-error: bundle exec rubocop is no executable
    
  3. This answer:

    (setq flycheck-command-wrapper-function
      (lambda (command)
        (append '("bundle" "exec") command)))
    

    It broke all checkers, because now it appends "bundle exec" to all checkers, not only ruby-rubocop, and it didn't work in ruby buffer (it still used rubocop without bundle exec). I don't know how to make this variable buffer-local.

| improve this question | | | | |
1

I'll let someone else clear that issue up for Flycheck.

But for completeness' sake: if you install a recent snapshot of Emacs 27 (to be released soon-ish) and enable flymake-mode in Ruby buffers, Rubocop integration is there, and it appends "bundle exec" when appropriate.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.