branch: elpa/rubocop commit 0b4e5ce56304892d6d57dd0792803471dd8e1224 Author: Nacho Barrientos <nacho.barrien...@cern.ch> Commit: Bozhidar Batsov <bozhidar.bat...@gmail.com>
Add an option to execute rubocop in a chroot --- README.md | 8 +++++++- rubocop.el | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2eaf0d9..623f934 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,13 @@ You can change the shell command used by `rubocop-autocorrect-*` commands via `r You can change the shell command used by `rubocop-format-*` commands via `rubocop-format-command`. -## Alternatives +You can run rubocop inside a chroot via schroot by setting: + +``` emacs-lisp +(setq rubocop-run-in-chroot t) +``` + +## alternatives [Flycheck](https://www.flycheck.org) and Flymake (Emacs built-in) provide more sophisticated integration with various lint tools, including RuboCop. diff --git a/rubocop.el b/rubocop.el index f8c56ec..932f5f4 100644 --- a/rubocop.el +++ b/rubocop.el @@ -85,6 +85,11 @@ It's basically auto-correction limited to layout cops." :group 'rubocop :type 'boolean) +(defcustom rubocop-run-in-chroot nil + "Runs rubocop inside a chroot via schroot setting the cwd to the project's root." + :group 'rubocop + :type 'boolean) + (defun rubocop-local-file-name (file-name) "Retrieve local filename if FILE-NAME is opened via TRAMP." (cond ((tramp-tramp-file-p file-name) @@ -128,6 +133,7 @@ When NO-ERROR is non-nil returns nil instead of raise an error." "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-run-in-chroot (format "schroot -d %s -- " (rubocop-project-root))) (if (and (not rubocop-prefer-system-executable) (rubocop-bundled-p)) "bundle exec " "") command (rubocop-build-requires)