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

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

[nongnu] elpa/rubocop 7026b86 04/64: Make rubocop.el usable :-)


From: ELPA Syncer
Subject: [nongnu] elpa/rubocop 7026b86 04/64: Make rubocop.el usable :-)
Date: Wed, 11 Aug 2021 10:07:54 -0400 (EDT)

branch: elpa/rubocop
commit 7026b866b0cabd897e0f44aff8ccbdf9ff427898
Author: Bozhidar Batsov <bozhidar@tradeo.com>
Commit: Bozhidar Batsov <bozhidar@tradeo.com>

    Make rubocop.el usable :-)
---
 README.md  | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 rubocop.el | 19 ++++++++++++++-----
 2 files changed, 74 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index e69de29..192c1f7 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,60 @@
+# Synopsis
+
+A simple Emacs interface for [RuboCop](https://github.com/bbatsov/rubocop).
+
+# Installation
+
+## Manual
+
+Just drop `rubocop.el` and `dash.el`. somewhere in your `load-path`. I
+favour the folder `~/.emacs.d/vendor`:
+
+```lisp
+(add-to-list 'load-path "~/emacs.d/vendor")
+(require 'rubocop)
+```
+
+## Marmalade
+
+If you're an Emacs 24 user or you have a recent version of package.el
+you can install rubocop.el from the [Marmalade](http://marmalade-repo.org/) 
repository.
+
+## MELPA
+
+If you're an Emacs 24 user or you have a recent version of package.el
+you can install rubocop.el from the [MELPA](http://melpa.milkbox.net/) 
repository.
+
+## Emacs Prelude
+
+`rubocop.el` is naturally part of the
+[Emacs Prelude](https://github.com/bbatsov/prelude). If you're a Prelude
+user - `rubocop.el` is already properly configured and ready for
+action.
+
+# Usage
+
+<kbd>M-x rubocop-run-on-project</kbd>
+
+<kbd>M-x rubocop-run-on-directory</kbd>
+
+<kbd>M-x rubocop-run-on-current-file</kbd>
+
+# Known issues
+
+Check out the project's
+[issue 
list](https://github.com/bbatsov/rubocop-emacs/issues?sort=created&direction=desc&state=open)
+a list of unresolved issues. By the way - feel free to fix any of them
+and send me a pull request. :-)
+
+# Contributors
+
+Here's a [list](https://github.com/bbatsov/rubocop-emacs/contributors) of all 
the people who have contributed to the
+development of rubocop.el.
+
+# Bugs & Improvements
+
+Bug reports and suggestions for improvements are always
+welcome. GitHub pull requests are even better! :-)
+
+Cheers,<br/>
+[Bozhidar](http://twitter.com/bbatsov)
diff --git a/rubocop.el b/rubocop.el
index 1b0fd3d..fca4ffb 100644
--- a/rubocop.el
+++ b/rubocop.el
@@ -50,7 +50,7 @@
   "A list of files considered to mark the root of a project.")
 
 (defun rubocop-project-root ()
-  "Retrieves the root directory of a project if available.
+  "Retrieve the root directory of a project if available.
 The current directory is assumed to be the project's root otherwise."
   (or (->> rubocop-project-root-files
         (--map (locate-dominating-file default-directory it))
@@ -65,11 +65,20 @@ The current directory is assumed to be the project's root 
otherwise."
 (defun rubocop-run-on-project ()
   "Run on current project."
   (interactive)
+  (rubocop-run-on-directory (rubocop-project-root)))
+
+(defun rubocop-run-on-directory (&optional directory)
+  "Run on DIRECTORY if present.
+Alternatively prompt user for directory."
+  (interactive)
   (rubocop-ensure-installed)
-  (compilation-start
-   (concat "rubocop -es " (rubocop-project-root))
-   'compilation-mode
-   (lambda (arg) (message arg) (rubocop-buffer-name (rubocop-project-root)))))
+  (let ((directory
+         (or directory
+             (read-directory-name "Select directory:"))))
+    (compilation-start
+     (concat "rubocop -es " directory)
+     'compilation-mode
+     (lambda (arg) (message arg) (rubocop-buffer-name directory)))))
 
 (defun rubocop-run-on-current-file ()
   "Run on current file."



reply via email to

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