checkdoc-batch Emacs package is designed to help running checkdoc in a
batch mode. This is useful, for example to run it as one of linters in a CI
pipeline.
If you’re using cask you can do something like
(development
(depends-on "checkdoc-batch"
:git "https://github.com/pkryger/ckeckdoc-batch.el.git"))If you want to install the package into your current Emacs, you can use
built-in use-package:
(use-package checkdoc-batch
:defer t
:vc (:url "https://github.com/pkryger/checkdoc-batch.el.git"
:rev :newest)))emacs --batch \
--load checkdoc-batch \
--funcall checkdoc-batch \
-- file1.el file2.el ... fileN.elYou can customize checkdoc-batch-ignored to ignore some files regardless if
these are passed on command line. This can become handy, when for example
you’re using cask and you want to relay on
cask files.
Run this snippet in an org-mode buffer:
(require 'flycheck)
(when-let* ((flycheck-command (let (temp-file)
(unwind-protect
(progn
(setq temp-file
(make-temp-file "checkdoc-batch"))
(with-current-buffer
(find-file-noselect temp-file)
(emacs-lisp-mode)
(flycheck-checker-shell-command
'emacs-lisp-checkdoc)))
(when temp-file
(delete-file temp-file)))))
(unescaped-command (replace-regexp-in-string
(rx "\\" (group any))
(rx (backref 1))
flycheck-command))
(flycheck-script (replace-regexp-in-string
(rx (one-or-more any)
" --eval " (group (one-or-more any))
" -- " (one-or-more any))
"(quote \\1)"
unescaped-command)))
(pp
(eval (car (read-from-string flycheck-script)))))
Modify the output above to process multiple files and signal error when anything has been reported. See checkdoc-batch.el.