emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/rubocop 1285711 44/64: [Fix #22] Add a clean way to load R


From: ELPA Syncer
Subject: [nongnu] elpa/rubocop 1285711 44/64: [Fix #22] Add a clean way to load RuboCop extensions
Date: Wed, 11 Aug 2021 10:08:02 -0400 (EDT)

branch: elpa/rubocop
commit 1285711c6a2651e1831651c528af5697876d5497
Author: Bozhidar Batsov <bozhidar@batsov.com>
Commit: Bozhidar Batsov <bozhidar@batsov.com>

    [Fix #22] Add a clean way to load RuboCop extensions
---
 rubocop.el | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/rubocop.el b/rubocop.el
index a7c7e37..1e123d3 100644
--- a/rubocop.el
+++ b/rubocop.el
@@ -58,6 +58,11 @@
   "The command used to run RuboCop's autocorrection."
   :type 'string)
 
+(defcustom rubocop-extensions
+  '()
+  "A list of extensions to be loaded by RuboCop."
+  :type '(repeat string))
+
 (defcustom rubocop-keymap-prefix (kbd "C-c C-r")
   "RuboCop keymap prefix."
   :group 'rubocop
@@ -89,10 +94,27 @@ When NO-ERROR is non-nil returns nil instead of raise an 
error."
   "Generate a name for the RuboCop buffer from FILE-OR-DIR."
   (concat "*RuboCop " file-or-dir "*"))
 
+(defun rubocop-build-requires ()
+  "Build RuboCop requires from `rubocop-extensions'."
+  (if rubocop-extensions
+      (concat
+       (mapconcat
+        (lambda (ext)
+          (format "--require %s" ext))
+        rubocop-extensions
+        " ")
+       " ")
+    ""))
+
 (defun rubocop-build-command (command path)
   "Build the full command to be run based on COMMAND and PATH.
 The command will be prefixed with `bundle exec` if RuboCop is bundled."
-  (concat (if (rubocop-bundled-p) "bundle exec " "") command " " path))
+  (concat
+   (if (rubocop-bundled-p) "bundle exec " "")
+   command
+   (rubocop-build-requires)
+   " "
+   path))
 
 (defun rubocop--dir-command (command &optional directory)
   "Run COMMAND on DIRECTORY (if present).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]