branch: elpa/flymake-collection commit 4b7051222b64650e2ec8c8340fdbe792138ede83 Author: Tomasz Hołubowicz <45176912+alternate...@users.noreply.github.com> Commit: GitHub <nore...@github.com>
checkers: Add hlint checker (#3) Co-authored-by: Mohsin Kaleem <mohk...@kisara.moe> --- checkers/flymake-rest-hlint.el | 65 ++++++++++++++++++++++++++++++++++++++++++ flymake-rest-hook.el | 1 + 2 files changed, 66 insertions(+) diff --git a/checkers/flymake-rest-hlint.el b/checkers/flymake-rest-hlint.el new file mode 100644 index 0000000000..50201f0c4c --- /dev/null +++ b/checkers/flymake-rest-hlint.el @@ -0,0 +1,65 @@ +;;; flymake-rest-hlint.el --- HLint diagnostic function -*- lexical-binding: t -*- + +;; Copyright (c) 2021 Mohsin Kaleem + +;; Permission is hereby granted, free of charge, to any person obtaining a copy +;; of this software and associated documentation files (the "Software"), to deal +;; in the Software without restriction, including without limitation the rights +;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +;; copies of the Software, and to permit persons to whom the Software is +;; furnished to do so, subject to the following conditions: + +;; The above copyright notice and this permission notice shall be included in all +;; copies or substantial portions of the Software. + +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. + +;;; Commentary: + +;; `flymake' syntax checker for Haskell using hlint. + +;;; Code: + +(require 'flymake) +(require 'flymake-rest) + +(eval-when-compile + (require 'flymake-rest-define)) + +;;;###autoload (autoload 'flymake-rest-hlint "flymake-rest-hlint") +(flymake-rest-define-rx flymake-rest-hlint + "A Haskell syntax and style checker using hlint. + +See URL `https://github.com/ndmitchell/hlint'." + :title "hlint" + :pre-let ((hlint-exec (executable-find "hlint"))) + :pre-check (unless hlint-exec + (error "Cannot find hlint executable")) + :write-type 'pipe + :command (list hlint-exec "-" "--no-exit-code") + :regexps + ((error bol (file-name) ":" line ":" column (? "-" end-column) ": Error: " + (message (one-or-more not-newline) + (zero-or-more "\n" + (one-or-more not-newline))) + eol) + (warning bol (file-name) ":" line ":" column (? "-" end-column) ": Warning: " + (message (one-or-more not-newline) + (zero-or-more "\n" + (one-or-more not-newline))) + eol) + (note bol (file-name) ":" line ":" column (? "-" end-column) ": Suggestion: " + (message (one-or-more not-newline) + (zero-or-more "\n" + (one-or-more not-newline))) + eol))) + +(provide 'flymake-rest-hlint) + +;;; flymake-rest-hlint.el ends here diff --git a/flymake-rest-hook.el b/flymake-rest-hook.el index e3a8bb6901..0534b97f78 100644 --- a/flymake-rest-hook.el +++ b/flymake-rest-hook.el @@ -42,6 +42,7 @@ (c++-mode flymake-rest-clang (flymake-rest-gcc :disabled t)) + (haskell-mode flymake-rest-hlint) (js-mode flymake-rest-eslint) (js2-mode flymake-rest-eslint) (typescript-mode flymake-rest-eslint)