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

    Add linter Makefile and fix lint errors
---
 Makefile                              | 31 +++++++++++++++++++++++++++++++
 checkers/flymake-rest-awk-gawk.el     |  4 ++++
 checkers/flymake-rest-clang.el        |  4 ++++
 checkers/flymake-rest-eslint.el       |  4 ++++
 checkers/flymake-rest-gcc.el          |  4 ++++
 checkers/flymake-rest-html-tidy.el    |  4 ++++
 checkers/flymake-rest-jq.el           |  4 ++++
 checkers/flymake-rest-jsonlint.el     |  4 ++++
 checkers/flymake-rest-less.el         |  4 ++++
 checkers/flymake-rest-lua.el          |  4 ++++
 checkers/flymake-rest-luacheck.el     | 10 +++++++---
 checkers/flymake-rest-markdownlint.el |  4 ++++
 checkers/flymake-rest-mypy.el         |  4 ++++
 checkers/flymake-rest-proselint.el    |  4 ++++
 checkers/flymake-rest-pycodestyle.el  |  4 ++++
 checkers/flymake-rest-pylint.el       |  4 ++++
 checkers/flymake-rest-rubocop.el      |  4 ++++
 checkers/flymake-rest-shellcheck.el   |  4 ++++
 checkers/flymake-rest-sql-lint.el     |  4 ++++
 checkers/flymake-rest-sqlint.el       |  4 ++++
 checkers/flymake-rest-xmllint.el      |  4 ++++
 checkers/flymake-rest-yamllint.el     |  4 ++++
 flymake-rest-commands.el              | 15 ++++++++++++---
 flymake-rest-define.el                | 15 +++++++++------
 flymake-rest-hook.el                  |  6 ++++--
 flymake-rest.el                       |  3 ++-
 26 files changed, 145 insertions(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..70201e67d6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,31 @@
+EMACS ?= emacs
+SRC   := *.el checkers/*.el
+
+.PHONY: lint
+lint: compile checkdoc
+
+.PHONY: checkdoc
+checkdoc: ## Check for missing or poorly formatted docstrings
+       @for file in $(SRC); do \
+           echo "[checkdoc] $$file" ;\
+           $(EMACS) -Q --batch \
+               --eval "(or (fboundp 'checkdoc-file) (kill-emacs))" \
+               --eval "(setq sentence-end-double-space nil)" \
+               --eval "(checkdoc-file \"$$file\")" 2>&1 \
+               | grep . && exit 1 || true ;\
+       done
+
+.PHONY: compile
+compile: ## Check for byte-compiler errors
+       @for file in $(SRC); do \
+           echo "[compile] $$file" ;\
+           rm -f "$${file}c" ;\
+           $(EMACS) -Q --batch -L . -f batch-byte-compile $$file 2>&1 \
+               | grep -v "^Wrote" \
+               | grep . && exit 1 || true ;\
+       done
+
+.PHONY: clean
+clean: ## Remove build artifacts
+       @echo "[clean]" *.elc checkers/*.elc
+       @rm -f *.elc checkers/*.elc
diff --git a/checkers/flymake-rest-awk-gawk.el 
b/checkers/flymake-rest-awk-gawk.el
index 0f4e3dd77f..f03fb38ee6 100644
--- a/checkers/flymake-rest-awk-gawk.el
+++ b/checkers/flymake-rest-awk-gawk.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for awk using GNU awk's built-in lint checker.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-clang.el b/checkers/flymake-rest-clang.el
index 41c9b34918..fd4f28a79d 100644
--- a/checkers/flymake-rest-clang.el
+++ b/checkers/flymake-rest-clang.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for c using Clang.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-eslint.el b/checkers/flymake-rest-eslint.el
index 7ca7288a65..6da3aacea6 100644
--- a/checkers/flymake-rest-eslint.el
+++ b/checkers/flymake-rest-eslint.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax and style checker for Javascript using eslint.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-gcc.el b/checkers/flymake-rest-gcc.el
index 16502840f4..e56b00fe01 100644
--- a/checkers/flymake-rest-gcc.el
+++ b/checkers/flymake-rest-gcc.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for c using GCC.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-html-tidy.el 
b/checkers/flymake-rest-html-tidy.el
index 41ba2c7000..55a4ff6e28 100644
--- a/checkers/flymake-rest-html-tidy.el
+++ b/checkers/flymake-rest-html-tidy.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax and style checker for HTML using Tidy.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-jq.el b/checkers/flymake-rest-jq.el
index 8f0495bd25..729b3f0819 100644
--- a/checkers/flymake-rest-jq.el
+++ b/checkers/flymake-rest-jq.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for JSON using jq.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-jsonlint.el 
b/checkers/flymake-rest-jsonlint.el
index a13a8e86dc..a66e201929 100644
--- a/checkers/flymake-rest-jsonlint.el
+++ b/checkers/flymake-rest-jsonlint.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for JSON using jsonlint.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-less.el b/checkers/flymake-rest-less.el
index 0b3a2edc29..b89331788b 100644
--- a/checkers/flymake-rest-less.el
+++ b/checkers/flymake-rest-less.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for LESS using the less compiler.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-lua.el b/checkers/flymake-rest-lua.el
index 712c60bf54..3731b4554a 100644
--- a/checkers/flymake-rest-lua.el
+++ b/checkers/flymake-rest-lua.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for lua using the lua compiler.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-luacheck.el 
b/checkers/flymake-rest-luacheck.el
index d34516885f..83127ae962 100644
--- a/checkers/flymake-rest-luacheck.el
+++ b/checkers/flymake-rest-luacheck.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for lua using luacheck.
+
 ;;; Code:
 
 (require 'flymake)
@@ -39,7 +43,7 @@ non-nil, pass the standards via one or more `--std' options."
                          (string :tag "Standard name")))
   :group 'flymake-rest)
 
-(defcustom flymake-luacheck-rc nil ; ".luacheckrc"
+(defcustom flymake-rest-luacheck-rc nil ; ".luacheckrc"
   "Optional configuration file for luacheck."
   :type '(choice (const :tag "Default" nil)
                  (file :tag "Config file"))
@@ -62,8 +66,8 @@ See URL `https://github.com/mpeterv/luacheck'."
              ,@(when flymake-rest-luacheck-standards
                  (list "--std"
                        (mapconcat #'identity flymake-rest-luacheck-standards 
"+")))
-             ,@(when flymake-luacheck-rc
-                 (list "--config" flymake-luacheck-rc))
+             ,@(when flymake-rest-luacheck-rc
+                 (list "--config" flymake-rest-luacheck-rc))
              ,@(when-let ((file (buffer-file-name flymake-rest-source)))
                  (list "--filename" file))
              "-")
diff --git a/checkers/flymake-rest-markdownlint.el 
b/checkers/flymake-rest-markdownlint.el
index f8d14d3280..200ea6bd8e 100644
--- a/checkers/flymake-rest-markdownlint.el
+++ b/checkers/flymake-rest-markdownlint.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for markdown using markdownlint.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-mypy.el b/checkers/flymake-rest-mypy.el
index 0f3b451e54..6b2ef64089 100644
--- a/checkers/flymake-rest-mypy.el
+++ b/checkers/flymake-rest-mypy.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for python using mypy.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-proselint.el 
b/checkers/flymake-rest-proselint.el
index 6443315ff6..399ebf6b37 100644
--- a/checkers/flymake-rest-proselint.el
+++ b/checkers/flymake-rest-proselint.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for prose using proselint.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-pycodestyle.el 
b/checkers/flymake-rest-pycodestyle.el
index 5531efc900..fb785297c2 100644
--- a/checkers/flymake-rest-pycodestyle.el
+++ b/checkers/flymake-rest-pycodestyle.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for python using pycodestyle.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-pylint.el b/checkers/flymake-rest-pylint.el
index d967591b30..65a3015c1f 100644
--- a/checkers/flymake-rest-pylint.el
+++ b/checkers/flymake-rest-pylint.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for python using pylint.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-rubocop.el b/checkers/flymake-rest-rubocop.el
index be91eafd50..1cbb4fc4e0 100644
--- a/checkers/flymake-rest-rubocop.el
+++ b/checkers/flymake-rest-rubocop.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for ruby using rubocop.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-shellcheck.el 
b/checkers/flymake-rest-shellcheck.el
index f71ad410a1..e8d626f03b 100644
--- a/checkers/flymake-rest-shellcheck.el
+++ b/checkers/flymake-rest-shellcheck.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for POSIX shell (and bash) using shellcheck.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-sql-lint.el 
b/checkers/flymake-rest-sql-lint.el
index fa47fc85c7..0de3044351 100644
--- a/checkers/flymake-rest-sql-lint.el
+++ b/checkers/flymake-rest-sql-lint.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for sql using sql-lint.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-sqlint.el b/checkers/flymake-rest-sqlint.el
index 8be965d594..1848eae120 100644
--- a/checkers/flymake-rest-sqlint.el
+++ b/checkers/flymake-rest-sqlint.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for sql using sqlint.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-xmllint.el b/checkers/flymake-rest-xmllint.el
index 6d7ca9e7c7..d4356dbb92 100644
--- a/checkers/flymake-rest-xmllint.el
+++ b/checkers/flymake-rest-xmllint.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for XML using xmllint.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/checkers/flymake-rest-yamllint.el 
b/checkers/flymake-rest-yamllint.el
index 01e545472c..7a2d83e8e0 100644
--- a/checkers/flymake-rest-yamllint.el
+++ b/checkers/flymake-rest-yamllint.el
@@ -20,6 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; `flymake' syntax checker for yaml using yamllint.
+
 ;;; Code:
 
 (require 'flymake)
diff --git a/flymake-rest-commands.el b/flymake-rest-commands.el
index 3d0f5fb377..fd9e8965e8 100644
--- a/flymake-rest-commands.el
+++ b/flymake-rest-commands.el
@@ -20,6 +20,11 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
+;;; Commentary:
+
+;; This file exposes a bunch of helper commands for using and configuring 
flymake
+;; interactively.
+
 ;;; Code:
 
 (require 'flymake)
@@ -49,6 +54,8 @@ they aren't associated with the current mode."
      :test (lambda (a b) (string-equal (car a) (car b))))))
 
 (defun flymake-rest-change-checker--read-checkers (&optional all-modes)
+  "Read one or more flymake checkers.
+See `flymake-rest-change-checker--cands' for a description of ALL-MODES."
   (let* ((cands (flymake-rest-change-checker--cands all-modes))
          (group-function (lambda (cand transform)
                            (if transform
@@ -75,9 +82,11 @@ they aren't associated with the current mode."
 
 ;;;###autoload
 (defun flymake-rest-change-checker (checkers)
-  "Interactively select and enable/disable checker for the current 
`major-mode'.
-With ARG select a checker regardless of `major-mode'."
-  (interactive (list (flymake-rest-change-checker--read-checkers 
current-prefix-arg)))
+  "Interactively enable/disable flymake CHECKERS.
+With `current-prefix-arg' select a checker regardless of `major-mode'."
+  (interactive
+   (list
+    (flymake-rest-change-checker--read-checkers current-prefix-arg)))
   (when checkers
     (dolist (checker checkers)
       (cl-destructuring-bind (_cand _mode checker exists) checker
diff --git a/flymake-rest-define.el b/flymake-rest-define.el
index 35749edc04..c509550085 100644
--- a/flymake-rest-define.el
+++ b/flymake-rest-define.el
@@ -165,7 +165,7 @@ of the `current-buffer'. The variable 
flymake-rest-temp-file and
 flymake-rest-temp-dir will be bound in the body of NAME and provide
 access to this temp-file.
 When set to 'pipe, all of the `current-buffer' will be passed to the
-process on its standard-input stream after it has begun.
+process on its standard input stream after it has begun.
 
 SOURCE-INPLACE determines whether to also create a temporary directory
 for a temporary file (when using a WRITE-TYPE of 'file) or whether to
@@ -308,7 +308,7 @@ exit status %d\nStderr: %s"
 (eval-when-compile
   (require 'rx))
 
-(defconst flymake-rest-parse-rx-constituents
+(defconst flymake-rest-define-parse-rx-constituents
   `((file-name ,(lambda (body)
                   (rx-to-string
                    `(group-n 1 ,@(or (cdr body)
@@ -345,7 +345,7 @@ turned into a keyword by this macro) and the cdr should be a
 sequence of entries that can be interpreted by the `rx' macro.
 To simplify matching specific fields in the parsed output several
 helper extensions to `rx' have been defined such as file-name or
-line. For a list of these see `flymake-rest-parse-rx-constituents'.
+line. For a list of these see `flymake-rest-define-parse-rx-constituents'.
 The only required fields that MUST be parsed are the line number
 and message. If these are ommited the matched diagnostic will be
 skipped.
@@ -359,7 +359,7 @@ For an example of this macro in action, see 
`flymake-rest-pycodestyle'."
   (unless (> (length regexps) 0)
     (error "Must supply at least one regexp for error, warning or note"))
 
-  (let* ((group-count (length flymake-rest-parse-rx-constituents))
+  (let* ((group-count (length flymake-rest-define-parse-rx-constituents))
          (regexps
           ;; To avoid having to rematch each diagnostic more than once we 
append
           ;; a special extra capture group (greater than all the ones above) 
that
@@ -371,7 +371,7 @@ For an example of this macro in action, see 
`flymake-rest-pycodestyle'."
                    collect (cons `(seq ,@regex (group-n ,count ""))
                                  (intern (concat ":" (symbol-name 
severity))))))
          (combined-regex
-          (let ((rx-constituents (append flymake-rest-parse-rx-constituents
+          (let ((rx-constituents (append 
flymake-rest-define-parse-rx-constituents
                                          (bound-and-true-p rx-constituents) 
nil)))
             (rx-to-string `(or ,@(mapcar #'car regexps))
                           'no-group)))
@@ -467,7 +467,10 @@ output again and again.
 
 The value of the current entry from GENERATOR in ENUMERATE-PARSER will be set 
to
 the variable `it'. ENUMERATE-PARSER should evaluate to a form that can be 
passed
-to `flymake-make-diagnostic'."
+to `flymake-make-diagnostic'.
+
+See `flymake-rest-define' for a description of NAME, DOCSTRING, TITLE, COMMAND,
+WRITE-TYPE, SOURCE-INPLACE, PRE-LET, and PRE-CHECK."
   (declare (indent defun) (doc-string 2))
   (let ((entries-var 'flymake-rest-entries)
         (parsed-var 'flymake-rest-parsed))
diff --git a/flymake-rest-hook.el b/flymake-rest-hook.el
index c52f8b7b03..e3a8bb6901 100644
--- a/flymake-rest-hook.el
+++ b/flymake-rest-hook.el
@@ -20,8 +20,10 @@
 ;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
 ;; SOFTWARE.
 
-;;; Commentary
-;; This file implements a way to associate major-modes to flymake checkers.
+;;; Commentary:
+
+;; This file implements a way to associate major-modes with flymake checkers.
+;; This can be used to automatically enable certain checkers on certain modes.
 
 ;;; Code:
 
diff --git a/flymake-rest.el b/flymake-rest.el
index 8c0dc31841..b1b827e171 100644
--- a/flymake-rest.el
+++ b/flymake-rest.el
@@ -6,7 +6,7 @@
 ;; Created: 15 June 2021
 ;; Homepage: https://github.com/mohkale/flymake-rest
 ;; Keywords: language tools
-;; Package-Requires: ((emacs "28.1") (let-alist "1.0") (flymake-rest "1.2.1))
+;; Package-Requires: ((emacs "28.1") (let-alist "1.0") (flymake "1.2.1"))
 ;; SPDX-License-Identifier: MIT
 ;; Version: 1.0.0
 
@@ -68,6 +68,7 @@ like output from OUTPUT into a list and then returns it."
   (let (objects
         (json-array-type 'list)
         (json-false nil))
+    (ignore json-array-type json-false)
     (with-temp-buffer
       (insert output)
       (goto-char (point-min))

Reply via email to