elixir: add flycheck support for credo

This commit is contained in:
syl20bnr 2016-05-31 21:51:49 -04:00
parent dd572af071
commit 5b97df814e
2 changed files with 32 additions and 3 deletions

View File

@ -6,7 +6,9 @@
- [[#description][Description]]
- [[#install][Install]]
- [[#configuration][Configuration]]
- [[#flycheck-support-for-mix-compile][Flycheck support for mix compile]]
- [[#flycheck][Flycheck]]
- [[#credo][Credo]]
- [[#mix-compile][mix compile]]
- [[#key-bindings][Key bindings]]
- [[#refcard][Refcard]]
- [[#help][Help]]
@ -34,6 +36,7 @@ features like:
- Elixir project management
- Integration with [[http://company-mode.github.io/][company-mode]]
- Flycheck support for mix compile
- Flycheck support for [[https://github.com/rrrene/credo][credo]]
* Install
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
@ -41,7 +44,27 @@ add =elixir= to the existing =dotspacemacs-configuration-layers= list in this
file.
* Configuration
** Flycheck support for mix compile
** Flycheck
*** 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:
#+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
*** mix compile
*Important:*
Elixir compilation is based on macros and is unsafe since arbitrary code can
be run during compilation. Therefore Spacemacs disable compilation flycheck
@ -63,7 +86,6 @@ Emacs won't ask you if the variable is safe whenever an elixir file is opened.
Remember that you can check the flycheck checkers enabled with ~SPC e v~.
* Key bindings
** Refcard
You find and overview of all the key-bindings on the [[file:alchemist-refcard.pdf][Alchemist-Refcard]].

View File

@ -13,6 +13,8 @@
'(
alchemist
company
(flycheck-elixir-credo
:location (recipe :fetcher github :repo "smeevil/flycheck-elixir-credo"))
(elixir-flycheck-mix-compile
:location local
:toggle (configuration-layer/package-usedp 'flycheck))
@ -117,6 +119,11 @@
(evil-define-key 'normal mode
(kbd "q") 'quit-window))))
(defun elixir/init-flycheck-elixir-credo ()
(use-package flycheck-elixir-credo
:defer t
:init (add-hook 'elixir-mode-hook 'flycheck-elixir-credo-setup)))
(defun elixir/init-elixir-flycheck-mix-compile ()
(use-package elixir-flycheck-mix-compile
:commands (elixir-flycheck-mix-compile-setup)