diff options
author | Timo Wilken | 2022-12-30 10:54:17 +0100 |
---|---|---|
committer | Timo Wilken | 2022-12-30 10:54:17 +0100 |
commit | 0f308b1c90444f5f0293bf40aa1ef177bc51036c (patch) | |
tree | b052860a66b8bf3b094fa16e4538887003c37ada /tw/home/files/emacs-packages/actionlint.el | |
parent | da1ff8a0816e430d2c035217d80db3be5cc919ab (diff) |
Reorganise Guix home declaration into module tree
Diffstat (limited to 'tw/home/files/emacs-packages/actionlint.el')
-rw-r--r-- | tw/home/files/emacs-packages/actionlint.el | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tw/home/files/emacs-packages/actionlint.el b/tw/home/files/emacs-packages/actionlint.el new file mode 100644 index 00000000..3c37e34b --- /dev/null +++ b/tw/home/files/emacs-packages/actionlint.el @@ -0,0 +1,34 @@ +;;; actionlint.el --- Flycheck checker for GitHub Actions. +;;; Commentary: +;; GitHub Actions are defined using mostly plain YAML files. +;; Actionlint is a linter catching GitHub Action-specific mistakes, and also +;; checks Shell and Python code embedded in Actions (using shellcheck and +;; pyflakes, respectively). +;;; Code: + +(require 'flycheck) + +(defun actionlint-github-workflow-p () + "Does the current buffer contain a GitHub Action?" + (string-match-p "\\.github/workflows/[^/]+\\.yml\\'" (buffer-file-name))) + +(flycheck-def-executable-var actionlint "actionlint") + +(flycheck-define-checker actionlint + "A syntax checker and linter for alidist recipes." + ;; `flycheck-alidist-executable' automatically overrides the car of the + ;; :command list if set and non-nil. + :command ("actionlint" "-no-color" "-oneline" source) + :error-patterns + ((error line-start (file-name) ":" line ":" column ": " (message) + " [" (id (minimal-match (one-or-more not-newline))) "]" line-end)) + ;; Only enable this in actual GitHub Actions, not just any YAML document. + :modes (yaml-mode) + :predicate actionlint-github-workflow-p + ;; Also check the document with YAML checkers, whether or not we have errors. + :next-checkers (yaml-ruby yaml-yamllint)) + +(add-to-list 'flycheck-checkers 'actionlint) + +(provide 'actionlint) +;;; actionlint.el ends here |