branch: elpa/flymake-collection
commit 5a1549919eaffbf45efeb25fa847b6533681f562
Author: Mohsin Kaleem <mohk...@kisara.moe>
Commit: Mohsin Kaleem <mohk...@kisara.moe>

    (checkers): Add sqlint checker
    
    Taken pretty much directly from flycheck.
---
 checkers/flymake-rest-sqlint.el | 61 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/checkers/flymake-rest-sqlint.el b/checkers/flymake-rest-sqlint.el
new file mode 100644
index 0000000000..ffd933d903
--- /dev/null
+++ b/checkers/flymake-rest-sqlint.el
@@ -0,0 +1,61 @@
+;;; flymake-rest-sqlint.el --- SQL 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.
+
+;;; Code:
+
+(require 'flymake)
+(require 'flymake-rest)
+
+(eval-when-compile
+  (require 'flymake-rest-define)
+  (require 'flymake-rest-parse-rx))
+
+;;;###autoload (autoload 'flymake-rest-sqlint "flymake-rest-sqlint")
+(flymake-rest-define flymake-rest-sqlint
+  "A SQL syntax checker using the sqlint tool.
+
+See URL `https://github.com/purcell/sqlint'."
+  :title "sql-lint"
+  :pre-let ((lint-exec (executable-find "sqlint")))
+  :pre-check (unless lint-exec
+               (error "Cannot find sqlint executable"))
+  :write-type 'pipe
+  :command (list lint-exec)
+  :error-parser
+  (flymake-rest-parse-rx
+    ((warning bol "stdin:" line ":" column ":WARNING "
+       (message (one-or-more not-newline)
+         (zero-or-more "\n"
+           (one-or-more "  ")
+           (one-or-more not-newline)))
+       eol)
+      (error bol "stdin:" line ":" column ":ERROR "
+        (message (one-or-more not-newline)
+          (zero-or-more "\n"
+            (one-or-more "  ")
+            (one-or-more not-newline)))
+        eol))))
+
+(provide 'flymake-rest-sqlint)
+
+;;; flymake-rest-sqlint.el ends here
+

Reply via email to