[emacs] flycheck - activate yamllint and use .yamllint.yml

Open YAML file and use:

  M-x flycheck-mode

Since we use yamllint from local/py3/bin, creating a virtualenv is a
prerequisite:

  make pyenv

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-06-05 17:42:06 +02:00
parent 5a7b12ee6f
commit 6b9633098d
1 changed files with 22 additions and 18 deletions

View File

@ -50,37 +50,41 @@
((nil ((nil
. ((fill-column . 80) . ((fill-column . 80)
(indent-tabs-mode . nil) (indent-tabs-mode . nil)
))
(makefile-gmake-mode
. ((indent-tabs-mode . t)
))
(python-mode
. ((indent-tabs-mode . nil)
;; project root folder is where the `.dir-locals.el' is located ;; project root folder is where the `.dir-locals.el' is located
(eval . (setq-local (eval . (setq-local
prj-root (locate-dominating-file default-directory ".dir-locals.el"))) prj-root (locate-dominating-file default-directory ".dir-locals.el")))
(eval . (setq-local (eval . (setq-local
python-environment-directory (expand-file-name "./local" prj-root))) python-environment-directory (expand-file-name "./local" prj-root)))
;; use 'py3' enviroment as default ;; use 'py3' enviroment as default
(eval . (setq-local (eval . (setq-local
python-environment-default-root-name "py3")) python-environment-default-root-name "py3"))
(eval . (setq-local (eval . (setq-local
python-shell-virtualenv-root python-shell-virtualenv-root
(concat python-environment-directory (expand-file-name python-environment-default-root-name python-environment-directory)
"/" ))
python-environment-default-root-name)))
;; python-shell-virtualenv-path is obsolete, use python-shell-virtualenv-root!
;; (eval . (setq-local
;; python-shell-virtualenv-path python-shell-virtualenv-root))
(eval . (setq-local (eval . (setq-local
python-shell-interpreter python-shell-interpreter
(expand-file-name "bin/python" python-shell-virtualenv-root))) (expand-file-name "bin/python" python-shell-virtualenv-root)))
))
(makefile-gmake-mode
. ((indent-tabs-mode . t)
))
(yaml-mode
. (
;; flycheck should use the local py3 environment
(eval . (setq-local
flycheck-yaml-yamllint-executable
(expand-file-name "bin/yamllint" python-shell-virtualenv-root)))
(eval . (setq-local
flycheck-yamllintrc
(expand-file-name ".yamllint.yml" prj-root)))
(flycheck-checker . yaml-yamllint)
))
(python-mode
. ((indent-tabs-mode . nil)
(eval . (setq-local (eval . (setq-local
python-environment-virtualenv python-environment-virtualenv