diff --git a/README b/README index 88e4c24..83990e2 100644 --- a/README +++ b/README @@ -24,3 +24,10 @@ my .emacs looks like so: (add-to-list 'auto-mode-alist '("\\.pp$" . puppet-mode)) (require 'flymake-puppet) (add-hook 'puppet-mode-hook (lambda () (flymake-puppet-load))) + +You can override the command and args to use. This can e.g. be useful if you want +to invoke puppet-lint through bundler or if you want to ignore certain checks: + + (setq flymake-puppet-lint-command "bundle") + (setq flymake-puppet-lint-args '("exec" "puppet-lint" "--no-autoloader_layout-check")) + diff --git a/flymake-puppet.el b/flymake-puppet.el index 00f8b4b..d3a68d1 100644 --- a/flymake-puppet.el +++ b/flymake-puppet.el @@ -2,6 +2,12 @@ ;; Deepak Giridharagopal (require 'flymake) +(defvar flymake-puppet-lint-command "puppet-lint" + "How to invoke puppet-lint") + +(defvar flymake-puppet-lint-args nil + "Additional arguments to puppet-lint") + (defconst flymake-puppet-err-line-patterns '(("\\(.*line \\([0-9]+\\).*\\)" nil 2 nil 1) ("\\(.*.rb:[0-9]+.*\\)" nil nil nil 1))) @@ -16,9 +22,9 @@ location." (defun flymake-puppet-init () "Construct a command that flymake can use to check puppetscript source." - (list "puppet-lint" - (list (flymake-init-create-temp-buffer-copy - 'flymake-puppet-create-temp-in-system-tempdir)))) + (list flymake-puppet-lint-command (append flymake-puppet-lint-args + (list (flymake-init-create-temp-buffer-copy + 'flymake-puppet-create-temp-in-system-tempdir))))) (defun flymake-puppet-load () "Configure flymake mode to check the current buffer's puppet syntax. @@ -29,7 +35,7 @@ does not alter flymake's global configuration, so function (interactive) (set (make-local-variable 'flymake-allowed-file-name-masks) '(("." flymake-puppet-init))) (set (make-local-variable 'flymake-err-line-patterns) flymake-puppet-err-line-patterns) - (if (executable-find "puppet-lint") + (if (executable-find flymake-puppet-lint-command) (flymake-mode t) (message "Not enabling flymake: puppet-lint command not found")))