elixir: add support for credo

There was no flycheck-credo package in the layer.
Although it was described in documentation, how to install credo.
This commit fixes documentation and adds flycheck-credo package.
This commit is contained in:
denin 2016-12-25 00:58:47 +03:00 committed by d12frosted
parent 5b9d368a5f
commit 52ea26a052
No known key found for this signature in database
GPG Key ID: 8F60E862D6F5CE8F
3 changed files with 17 additions and 15 deletions

View File

@ -50,22 +50,16 @@ file.
time.
*** Credo
A flycheck checker for [[https://github.com/rrrene/credo][credo]] is installed. The check needs both =bunt= and
=credo= to be available, you can install them like this:
You need to install [[https://github.com/rrrene/credo][credo]] into your project. Fort this,
add ={:credo, "~> 0.5", only: [:dev, :test]}= to dependencies of your project (in file mix.exs) and
run:
#+BEGIN_SRC shell
git clone https://github.com/rrrene/bunt
cd bunt
mix archive.build
mix archive.install
#+END_SRC
#+BEGIN_SRC shell
git clone https://github.com/rrrene/credo
cd credo
mix deps.get
mix archive.build
mix archive.install
#+END_SRC
For more info about mix [[http://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html][see]].
You can tell flycheck-credo to call credo with the '--strict' argument.
#+BEGIN_SRC elisp
(setq flycheck-elixir-credo-strict t)
#+END_SRC
*** mix compile

View File

@ -34,4 +34,6 @@
(defun spacemacs//elixir-enable-compilation-checking ()
"Enable compile checking if `elixir-enable-compilation-checking' is non nil."
(when (or elixir-enable-compilation-checking)
(flycheck-mix-setup)))
(flycheck-mix-setup)
;; enable credo only if there are no compilation errors
(flycheck-add-next-checker 'elixir-mix '(warning . elixir-credo))))

View File

@ -16,6 +16,7 @@
elixir-mode
flycheck
flycheck-mix
flycheck-credo
ggtags
helm-gtags
ob-elixir
@ -130,6 +131,11 @@
(add-hook 'elixir-mode-local-vars-hook
'spacemacs//elixir-enable-compilation-checking))))
(defun elixir/init-flycheck-credo ()
(use-package flycheck-credo
:defer t
:init (add-hook 'flycheck-mode-hook #'flycheck-credo-setup)))
(defun elixir/init-elixir-mode ()
(use-package elixir-mode
:defer t))