If non-nil, moving point forward or backward between widgets by typing
'TAB' or 'S-TAB' skips over inactive widgets. The default value is nil.
+** Ruby mode
+New user option 'ruby-rubocop-use-bundler'. By default it retains the
+previous behavior: read the contens of Gemfile and act accordingly. But
+you can also set it to t or nil to skip the check.
+
** Miscellaneous
---
:type 'string
:safe 'stringp)
+(defcustom ruby-rubocop-use-bundler 'check
+ "Non-nil with allow `ruby-flymake-rubocop' to use `bundle exec'.
+When the value is `check', it will first see whether Gemfile exists in
+the same directory as the configuration file, and whether it mentions
+the gem \"rubocop\". When t, it's used unconditionally. "
+ :type '(choice (const :tag "Always" t)
+ (const :tag "No" nil)
+ (const :tag "If rubocop is in Gemfile" check))
+ :safe 'booleanp)
+
(defun ruby-flymake-rubocop (report-fn &rest _args)
"RuboCop backend for Flymake."
(unless (executable-find "rubocop")
finally (funcall report-fn diags)))))))
(defun ruby-flymake-rubocop--use-bundler-p (dir)
- (let ((file (expand-file-name "Gemfile" dir)))
- (and (file-exists-p file)
- (with-temp-buffer
- (insert-file-contents file)
- (re-search-forward "^ *gem ['\"]rubocop['\"]" nil t)))))
+ (cond
+ ((eq t ruby-rubocop-use-bundler)
+ t)
+ ((null ruby-rubocop-use-bundler)
+ nil)
+ (t
+ (let ((file (expand-file-name "Gemfile" dir)))
+ (and (file-exists-p file)
+ (with-temp-buffer
+ (insert-file-contents file)
+ (re-search-forward "^ *gem ['\"]rubocop['\"]" nil t)))))))
(defun ruby-flymake-auto (report-fn &rest args)
(apply