branch: elpa/flymake-collection commit 530e7085b5193fd6bf0e53dc80839f819d918d1a Author: Mohsin Kaleem <mohk...@kisara.moe> Commit: Mohsin Kaleem <mohk...@kisara.moe>
rename: Rename flymake-rest to flymake-collection * Rename `flymake-rest` to `flymake-collection`. This new name more clearly expresses the projects intentions. * Move all elisp files into the src/ subdirectory. This makes organisation clearer. --- Makefile | 8 +- README.org | 60 +++++----- .../checkers/flymake-collection-awk-gawk.el | 14 +-- .../checkers/flymake-collection-clang.el | 30 ++--- .../checkers/flymake-collection-eslint.el | 24 ++-- .../checkers/flymake-collection-gcc.el | 32 +++--- .../checkers/flymake-collection-hlint.el | 14 +-- .../checkers/flymake-collection-html-tidy.el | 14 +-- .../checkers/flymake-collection-jq.el | 14 +-- .../checkers/flymake-collection-jsonlint.el | 16 +-- .../checkers/flymake-collection-less.el | 14 +-- .../checkers/flymake-collection-lua.el | 14 +-- .../checkers/flymake-collection-luacheck.el | 32 +++--- .../checkers/flymake-collection-markdownlint.el | 22 ++-- .../checkers/flymake-collection-mypy.el | 16 +-- .../checkers/flymake-collection-proselint.el | 20 ++-- .../checkers/flymake-collection-pycodestyle.el | 16 +-- .../checkers/flymake-collection-pylint.el | 24 ++-- .../checkers/flymake-collection-rubocop.el | 26 ++--- .../checkers/flymake-collection-shellcheck.el | 34 +++--- .../checkers/flymake-collection-sql-lint.el | 22 ++-- .../checkers/flymake-collection-sqlint.el | 14 +-- .../checkers/flymake-collection-xmllint.el | 14 +-- .../checkers/flymake-collection-yamllint.el | 12 +- .../flymake-collection-commands.el | 28 ++--- .../flymake-collection-define.el | 125 +++++++++++---------- .../flymake-collection-hook.el | 112 +++++++++--------- flymake-rest.el => src/flymake-collection.el | 36 +++--- 28 files changed, 415 insertions(+), 392 deletions(-) diff --git a/Makefile b/Makefile index 70201e67d6..6b2afc0719 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -EMACS ?= emacs -SRC := *.el checkers/*.el +SRC := src/*.el src/checkers/*.el +EMACS ?= emacs --eval '(add-to-list (quote load-path) (concat default-directory "src/"))' .PHONY: lint lint: compile checkdoc @@ -27,5 +27,5 @@ compile: ## Check for byte-compiler errors .PHONY: clean clean: ## Remove build artifacts - @echo "[clean]" *.elc checkers/*.elc - @rm -f *.elc checkers/*.elc + @echo "[clean]" $(subst .el,.elc,$(SRC)) + @rm -f $(subst .el,.elc,$(SRC)) diff --git a/README.org b/README.org index 067245cd67..09aee749fe 100644 --- a/README.org +++ b/README.org @@ -1,15 +1,13 @@ -#+TITLE: flymake-rest +#+TITLE: flymake-collection #+AUTHOR: Mohsin Kaleem -#+html: <p align="right"><a href="https://melpa.org/#/flymake-rest"><img align="center" alt="MELPA" src="https://melpa.org/packages/flymake-rest-badge.svg"/></a></p> +#+html: <p align="right"><a href="https://melpa.org/#/flymake-collection"><img align="center" alt="MELPA" src="https://melpa.org/packages/flymake-collection-badge.svg"/></a></p> -Fill the gap between flymake and flycheck, one checker at a time. - -~flymake-rest~ tries to provide a comprehensive list of diagnostic-functions for use -with flymake, give users the tools to easily define new syntax checkers and help -selectively enable or disable diagnostic-functions based on major-modes. +~flymake-collection~ tries to provide a comprehensive list of diagnostic-functions +for use with flymake, give users the tools to easily define new syntax checkers and +help selectively enable or disable diagnostic-functions based on major-modes. The goal of this project is to make the transition from flycheck to flymake as easy as possible. @@ -35,7 +33,7 @@ as possible. #+begin_src emacs-lisp (push '("melpa" . "https://melpa.org/packages/") package-archives) (package-refresh-contents) - (package-install 'flymake-rest) + (package-install 'flymake-collection) #+end_src ** Configurations @@ -48,23 +46,23 @@ as possible. #+begin_src emacs-lisp (add-hook 'python-mode-hook (defun python-mode-setup-flymake () - (add-hook 'flymake-diagnostic-functions 'flymake-rest-pycodestyle nil t) + (add-hook 'flymake-diagnostic-functions 'flymake-collection-pycodestyle nil t) (flymake-mode +1))) #+end_src - For a list of supported syntax-checkers see [[file:checkers/][./checkers/]]. All of the defined - checkers are auto-loaded and have no other dependencies than ~flymake-rest~ so - once you've installed and compiled ~flymake-rest~ you can hook them into - flymake-diagnostic-functions without any extra configuration or loading being + For a list of supported syntax-checkers see [[file:src/checkers/][./src/checkers/]]. All of the defined + checkers are auto-loaded and have no other dependencies than ~flymake-collection~ + so once you've installed and compiled ~flymake-collection~ you can hook them into + ~flymake-diagnostic-functions~ without any extra configuration or loading being needed. *** Associating Checkers with Major Modes - ~flymake-rest~ provides a special configuration variable to let you associate + ~flymake-collection~ provides a special configuration variable to let you associate diagnostic functions with major-modes. This can be useful both for automatically enabling diagnostic functions and for interactively toggling them based on your configuration. - The ~flymake-rest-config~ config variable is an alist with the ~key~ being the + The ~flymake-collection-config~ config variable is an alist with the ~key~ being the major-mode and the ~cdr~ being the list of diagnostic functions for that mode. Each diagnostic function can be defined as the function symbol, or an alist with the ~car~ of the symbol being the function symbol and the ~cdr~ being a plist of @@ -78,12 +76,12 @@ as possible. #+begin_src emacs-lisp (push '(python-mode - flymake-rest-mypy ; Always added to diagnostic functions. - (flymake-rest-pycodestyle :disabled t) ; Never added. - (flymake-rest-pylint ; Added when predicate is true. + flymake-collection-mypy ; Always added to diagnostic functions. + (flymake-collection-pycodestyle :disabled t) ; Never added. + (flymake-collection-pylint ; Added when predicate is true. :predicate (lambda () (executable-find "pylint")))) - flymake-rest-config) + flymake-collection-config) #+end_src *Note*: The ~executable-find~ predicate example here is redundant, each checker will @@ -91,38 +89,42 @@ as possible. Lastly there's also a ~use-package~ keyword you can use to define config entries. This is just syntax sugar over pushing these values into - ~flymake-rest-config~ as shown above. + ~flymake-collection-config~ as shown above. #+begin_src emacs-lisp (use-package python-mode :flymake-hook (python-mode - flymake-rest-mypy ; Always added to diagnostic functions. - (flymake-rest-pycodestyle :disabled t) ; Never added. - (flymake-rest-pylint ; Added when predicate is true. + flymake-collection-mypy ; Always added to diagnostic functions. + (flymake-collection-pycodestyle :disabled t) ; Never added. + (flymake-collection-pylint ; Added when predicate is true. :predicate (lambda () (executable-find "pylint")))))) #+end_src **** Automatically Enabling Syntax Checkers - To automatically enable diagnostic functions based on ~flymake-rest-config~ you - have to call the ~flymake-rest-hook-setup~ function. + To automatically enable diagnostic functions based on ~flymake-collection-config~ you + have to call the ~flymake-collection-hook-setup~ function. This can be done through ~use-package~, for example: #+begin_src emacs-lisp - (use-package flymake-rest - :hook (after-init . flymake-rest-hook-setup)) + (use-package flymake-collection + :hook (after-init . flymake-collection-hook-setup)) #+end_src You can also interactively enable or disable a diagnostic-function from - ~flymake-rest-config~ using the ~flymake-rest-change-checker~ command. + ~flymake-collection-config~ using the ~flymake-collection-change-checker~ command. * Contributing Please do!. There are more linters out there than I have the time to explore, if you'd like to add support for a new linter or contribute improvements to an existing one, we'd be more than happy to accept. + When contributing please describe the exact version of the linter you're adding and + supply a sample file which triggers all the different lint types (info, error, + warning) supported by your linter. + * Appendix :ARCHIVE: -# LocalWords: flymake +# LocalWords: flymake linter # Local Variables: # eval: (toc-org-mode 1) diff --git a/checkers/flymake-rest-awk-gawk.el b/src/checkers/flymake-collection-awk-gawk.el similarity index 82% rename from checkers/flymake-rest-awk-gawk.el rename to src/checkers/flymake-collection-awk-gawk.el index f03fb38ee6..f3f6fed95f 100644 --- a/checkers/flymake-rest-awk-gawk.el +++ b/src/checkers/flymake-collection-awk-gawk.el @@ -1,4 +1,4 @@ -;;; flymake-rest-awk-gawk.el --- awk/gawk diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-awk-gawk.el --- awk/gawk diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-awk-gawk "flymake-rest-awk-gawk") -(flymake-rest-define-rx flymake-rest-awk-gawk +;;;###autoload (autoload 'flymake-collection-awk-gawk "flymake-collection-awk-gawk") +(flymake-collection-define-rx flymake-collection-awk-gawk "GNU awk's built-in --lint checker." :title "gawk-awk" :pre-let ((gawk-exec (executable-find "gawk"))) @@ -50,6 +50,6 @@ ((error bol (? "g") "awk: -:" line ": " (or "fatal" "error") ": " (message) eol) (warning bol (? "g") "awk: -:" line ": " "warning" ": " (message) eol))) -(provide 'flymake-rest-awk-gawk) +(provide 'flymake-collection-awk-gawk) -;;; flymake-rest-awk-gawk.el ends here +;;; flymake-collection-awk-gawk.el ends here diff --git a/checkers/flymake-rest-clang.el b/src/checkers/flymake-collection-clang.el similarity index 76% rename from checkers/flymake-rest-clang.el rename to src/checkers/flymake-collection-clang.el index fd4f28a79d..d640fa5c17 100644 --- a/checkers/flymake-rest-clang.el +++ b/src/checkers/flymake-collection-clang.el @@ -1,4 +1,4 @@ -;;; flymake-rest-clang.el --- Clang diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-clang.el --- Clang diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,20 +27,20 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -(defvar flymake-rest-clang-args +(defvar flymake-collection-clang-args '("-pedantic" "-pedantic-errors") - "Command line arguments always passed to `flymake-rest-clang'.") + "Command line arguments always passed to `flymake-collection-clang'.") -(defvar flymake-rest-clang-include-path nil - "Default include path for gcc in `flymake-rest-clang'.") +(defvar flymake-collection-clang-include-path nil + "Default include path for gcc in `flymake-collection-clang'.") -;;;###autoload (autoload 'flymake-rest-clang "flymake-rest-clang") -(flymake-rest-define-rx flymake-rest-clang +;;;###autoload (autoload 'flymake-collection-clang "flymake-collection-clang") +(flymake-collection-define-rx flymake-collection-clang "A C/C++ syntax checker using Clang. See URL `http://clang.llvm.org/'." @@ -54,14 +54,14 @@ See URL `http://clang.llvm.org/'." "-fno-color-diagnostics" ; Do not include color codes in output "-fno-caret-diagnostics" ; Do not visually indicate the source "-fno-diagnostics-show-option" ; Do not show the corresponding - "-iquote" ,(if-let ((file (buffer-file-name flymake-rest-source))) + "-iquote" ,(if-let ((file (buffer-file-name flymake-collection-source))) (file-name-directory file) (or (buffer-local-value 'default-directory - flymake-rest-source) + flymake-collection-source) default-directory)) - ,@(cl-loop for it in flymake-rest-clang-include-path + ,@(cl-loop for it in flymake-collection-clang-include-path collect (concat "-I" it)) - ,@flymake-rest-clang-args + ,@flymake-collection-clang-args "-x" ,(pcase major-mode ('c-mode "c") ((or 'c++-mode _) "c++")) @@ -71,6 +71,6 @@ See URL `http://clang.llvm.org/'." (warning bol "<stdin>:" line ":" column ": " "warning" ": " (message) eol) (note bol "<stdin>:" line ":" column ": " "note" ": " (message) eol))) -(provide 'flymake-rest-gcc) +(provide 'flymake-collection-gcc) -;;; flymake-rest-clang.el ends here +;;; flymake-collection-clang.el ends here diff --git a/checkers/flymake-rest-eslint.el b/src/checkers/flymake-collection-eslint.el similarity index 76% rename from checkers/flymake-rest-eslint.el rename to src/checkers/flymake-collection-eslint.el index 6da3aacea6..6d919bd044 100644 --- a/checkers/flymake-rest-eslint.el +++ b/src/checkers/flymake-collection-eslint.el @@ -1,4 +1,4 @@ -;;; flymake-rest-eslint.el --- ESLint diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-eslint.el --- ESLint diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-eslint "flymake-rest-eslint") -(flymake-rest-define-enumerate flymake-rest-eslint +;;;###autoload (autoload 'flymake-collection-eslint "flymake-collection-eslint") +(flymake-collection-define-enumerate flymake-collection-eslint "A Javascript syntax and style checker using eslint. See URL `https://eslint.org/'." @@ -46,25 +46,25 @@ See URL `https://eslint.org/'." `(,eslint-exec "--format=json" "--stdin" - ,@(when-let ((file (buffer-file-name flymake-rest-source))) + ,@(when-let ((file (buffer-file-name flymake-collection-source))) (list "--stdin-filename" file))) :generator (alist-get 'messages (caar - (flymake-rest-parse-json + (flymake-collection-parse-json (buffer-substring-no-properties (point-min) (point-max))))) :enumerate-parser (let-alist it - (let* ((start-loc (flymake-diag-region flymake-rest-source .line .column)) + (let* ((start-loc (flymake-diag-region flymake-collection-source .line .column)) (loc (cons (car start-loc) (cdr (if (and .endLine .endColumn) - (flymake-diag-region flymake-rest-source + (flymake-diag-region flymake-collection-source .endLine (1- .endColumn)) start-loc))))) - (list flymake-rest-source + (list flymake-collection-source (car loc) (cdr loc) (pcase .severity @@ -73,6 +73,6 @@ See URL `https://eslint.org/'." (_ :note)) (concat "[" .ruleId "] " .message))))) -(provide 'flymake-rest-eslint) +(provide 'flymake-collection-eslint) -;;; flymake-rest-eslint.el ends here +;;; flymake-collection-eslint.el ends here diff --git a/checkers/flymake-rest-gcc.el b/src/checkers/flymake-collection-gcc.el similarity index 75% rename from checkers/flymake-rest-gcc.el rename to src/checkers/flymake-collection-gcc.el index e56b00fe01..91334ecde0 100644 --- a/checkers/flymake-rest-gcc.el +++ b/src/checkers/flymake-collection-gcc.el @@ -1,4 +1,4 @@ -;;; flymake-rest-gcc.el --- GCC diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-gcc.el --- GCC diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -29,21 +29,21 @@ (require 'flymake) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -(defcustom flymake-rest-gcc-args +(defcustom flymake-collection-gcc-args '("-pedantic" "-pedantic-errors") - "Command line arguments always passed to `flymake-rest-gcc'." + "Command line arguments always passed to `flymake-collection-gcc'." :type 'list - :group 'flymake-rest) + :group 'flymake-collection) -(defcustom flymake-rest-gcc-include-path nil - "Default include path for gcc in `flymake-rest-gcc'." +(defcustom flymake-collection-gcc-include-path nil + "Default include path for gcc in `flymake-collection-gcc'." :type 'list - :group 'flymake-rest) + :group 'flymake-collection) -;;;###autoload (autoload 'flymake-rest-gcc "flymake-rest-gcc") -(flymake-rest-define-rx flymake-rest-gcc +;;;###autoload (autoload 'flymake-collection-gcc "flymake-collection-gcc") +(flymake-collection-define-rx flymake-collection-gcc "A C/C++ syntax checker using GCC. Requires GCC 4.4 or newer. See URL `https://gcc.gnu.org/'." @@ -54,14 +54,14 @@ Requires GCC 4.4 or newer. See URL `https://gcc.gnu.org/'." :write-type 'pipe :command `(,gcc-exec "-fshow-column" - "-iquote" ,(if-let ((file (buffer-file-name flymake-rest-source))) + "-iquote" ,(if-let ((file (buffer-file-name flymake-collection-source))) (file-name-directory file) (or (buffer-local-value 'default-directory - flymake-rest-source) + flymake-collection-source) default-directory)) - ,@(cl-loop for it in flymake-rest-gcc-include-path + ,@(cl-loop for it in flymake-collection-gcc-include-path collect (concat "-I" it)) - ,@flymake-rest-gcc-args + ,@flymake-collection-gcc-args "-x" ,(pcase major-mode ('c-mode "c") ((or 'c++-mode _) "c++")) @@ -75,6 +75,6 @@ Requires GCC 4.4 or newer. See URL `https://gcc.gnu.org/'." (warning bol "<stdin>:" line ":" column ": " "warning" ": " (message) eol) (note bol "<stdin>:" line ":" column ": " "note" ": " (message) eol))) -(provide 'flymake-rest-gcc) +(provide 'flymake-collection-gcc) -;;; flymake-rest-gcc.el ends here +;;; flymake-collection-gcc.el ends here diff --git a/checkers/flymake-rest-hlint.el b/src/checkers/flymake-collection-hlint.el similarity index 85% rename from checkers/flymake-rest-hlint.el rename to src/checkers/flymake-collection-hlint.el index 50201f0c4c..d2ae6e1f91 100644 --- a/checkers/flymake-rest-hlint.el +++ b/src/checkers/flymake-collection-hlint.el @@ -1,4 +1,4 @@ -;;; flymake-rest-hlint.el --- HLint diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-hlint.el --- HLint diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-hlint "flymake-rest-hlint") -(flymake-rest-define-rx flymake-rest-hlint +;;;###autoload (autoload 'flymake-collection-hlint "flymake-collection-hlint") +(flymake-collection-define-rx flymake-collection-hlint "A Haskell syntax and style checker using hlint. See URL `https://github.com/ndmitchell/hlint'." @@ -60,6 +60,6 @@ See URL `https://github.com/ndmitchell/hlint'." (one-or-more not-newline))) eol))) -(provide 'flymake-rest-hlint) +(provide 'flymake-collection-hlint) -;;; flymake-rest-hlint.el ends here +;;; flymake-collection-hlint.el ends here diff --git a/checkers/flymake-rest-html-tidy.el b/src/checkers/flymake-collection-html-tidy.el similarity index 81% rename from checkers/flymake-rest-html-tidy.el rename to src/checkers/flymake-collection-html-tidy.el index 55a4ff6e28..595c6fced4 100644 --- a/checkers/flymake-rest-html-tidy.el +++ b/src/checkers/flymake-collection-html-tidy.el @@ -1,4 +1,4 @@ -;;; flymake-rest-html-tidy.el --- Tidy-HTML5 diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-html-tidy.el --- Tidy-HTML5 diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-html-tidy "flymake-rest-html-tidy") -(flymake-rest-define-rx flymake-rest-html-tidy +;;;###autoload (autoload 'flymake-collection-html-tidy "flymake-collection-html-tidy") +(flymake-collection-define-rx flymake-collection-html-tidy "A HTML syntax and style checker using Tidy. See URL `https://github.com/htacg/tidy-html5'." @@ -47,6 +47,6 @@ See URL `https://github.com/htacg/tidy-html5'." ((error bol "line " line " column " column " - Error: " (message) eol) (warning bol "line " line " column " column " - Warning: " (message) eol))) -(provide 'flymake-rest-html-tidy) +(provide 'flymake-collection-html-tidy) -;;; flymake-rest-html-tidy.el ends here +;;; flymake-collection-html-tidy.el ends here diff --git a/checkers/flymake-rest-jq.el b/src/checkers/flymake-collection-jq.el similarity index 83% rename from checkers/flymake-rest-jq.el rename to src/checkers/flymake-collection-jq.el index 729b3f0819..ef3a475056 100644 --- a/checkers/flymake-rest-jq.el +++ b/src/checkers/flymake-collection-jq.el @@ -1,4 +1,4 @@ -;;; flymake-rest-jq.el --- jq diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-jq.el --- jq diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-jq "flymake-rest-jq") -(flymake-rest-define-rx flymake-rest-jq +;;;###autoload (autoload 'flymake-collection-jq "flymake-collection-jq") +(flymake-collection-define-rx flymake-collection-jq "JSON checker using the jq tool. This checker accepts multiple consecutive JSON values in a @@ -49,6 +49,6 @@ See URL `https://stedolan.github.io/jq/'." :regexps ((error bol "parse error: " (message) " at line " line ", column " column eol))) -(provide 'flymake-rest-jq) +(provide 'flymake-collection-jq) -;;; flymake-rest-jq.el ends here +;;; flymake-collection-jq.el ends here diff --git a/checkers/flymake-rest-jsonlint.el b/src/checkers/flymake-collection-jsonlint.el similarity index 77% rename from checkers/flymake-rest-jsonlint.el rename to src/checkers/flymake-collection-jsonlint.el index a66e201929..ff22074561 100644 --- a/checkers/flymake-rest-jsonlint.el +++ b/src/checkers/flymake-collection-jsonlint.el @@ -1,4 +1,4 @@ -;;; flymake-rest-jsonlint.el --- JSONLint diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-jsonlint.el --- JSONLint diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-jsonlint "flymake-rest-jsonlint") -(flymake-rest-define-rx flymake-rest-jsonlint +;;;###autoload (autoload 'flymake-collection-jsonlint "flymake-collection-jsonlint") +(flymake-collection-define-rx flymake-collection-jsonlint "A JSON syntax and style checker using jsonlint. See URL `https://github.com/zaach/jsonlint'." @@ -42,10 +42,10 @@ See URL `https://github.com/zaach/jsonlint'." :pre-check (unless jsonlint-exec (error "Cannot find jsonlint executable")) :write-type 'file - :command (list jsonlint-exec "-c" "-q" flymake-rest-temp-file) + :command (list jsonlint-exec "-c" "-q" flymake-collection-temp-file) :regexps ((error bol (file-name) ": line " line ", col " column ", " (message) eol))) -(provide 'flymake-rest-jsonlint) +(provide 'flymake-collection-jsonlint) -;;; flymake-rest-jsonlint.el ends here +;;; flymake-collection-jsonlint.el ends here diff --git a/checkers/flymake-rest-less.el b/src/checkers/flymake-collection-less.el similarity index 82% rename from checkers/flymake-rest-less.el rename to src/checkers/flymake-collection-less.el index b89331788b..22cb227166 100644 --- a/checkers/flymake-rest-less.el +++ b/src/checkers/flymake-collection-less.el @@ -1,4 +1,4 @@ -;;; flymake-rest-less.el --- Less diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-less.el --- Less diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-less "flymake-rest-less") -(flymake-rest-define-rx flymake-rest-less +;;;###autoload (autoload 'flymake-collection-less "flymake-collection-less") +(flymake-collection-define-rx flymake-collection-less "A LESS syntax checker using lessc. Requires lessc 1.4 or newer. @@ -48,7 +48,7 @@ See URL `http://lesscss.org'." :regexps ((error bol (+ not-newline) ": " (message) " in - on line " line ", column " column ":" eol))) -(provide 'flymake-rest-less) +(provide 'flymake-collection-less) -;;; flymake-rest-less.el ends here +;;; flymake-collection-less.el ends here diff --git a/checkers/flymake-rest-lua.el b/src/checkers/flymake-collection-lua.el similarity index 81% rename from checkers/flymake-rest-lua.el rename to src/checkers/flymake-collection-lua.el index 3731b4554a..b687b884db 100644 --- a/checkers/flymake-rest-lua.el +++ b/src/checkers/flymake-collection-lua.el @@ -1,4 +1,4 @@ -;;; flymake-rest-lua.el --- lua diagnostic function using the lua compiler -*- lexical-binding: t -*- +;;; flymake-collection-lua.el --- lua diagnostic function using the lua compiler -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-lua "flymake-rest-lua") -(flymake-rest-define-rx flymake-rest-lua +;;;###autoload (autoload 'flymake-collection-lua "flymake-collection-lua") +(flymake-collection-define-rx flymake-collection-lua "A Lua syntax checker using the Lua compiler. See URL `http://www.lua.org/'." @@ -48,6 +48,6 @@ See URL `http://www.lua.org/'." (minimal-match (zero-or-more not-newline)) ": stdin:" line ": " (message) eol))) -(provide 'flymake-rest-lua) +(provide 'flymake-collection-lua) -;;; flymake-rest-lua.el ends here +;;; flymake-collection-lua.el ends here diff --git a/checkers/flymake-rest-luacheck.el b/src/checkers/flymake-collection-luacheck.el similarity index 74% rename from checkers/flymake-rest-luacheck.el rename to src/checkers/flymake-collection-luacheck.el index 83127ae962..c31818b321 100644 --- a/checkers/flymake-rest-luacheck.el +++ b/src/checkers/flymake-collection-luacheck.el @@ -1,4 +1,4 @@ -;;; flymake-rest-luacheck.el --- luacheck diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-luacheck.el --- luacheck diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,12 +27,12 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -(defcustom flymake-rest-luacheck-standards nil +(defcustom flymake-collection-luacheck-standards nil "The standards to use in luacheck. The value of this variable is either a list of strings denoting @@ -41,16 +41,16 @@ non-nil, pass the standards via one or more `--std' options." :type '(choice (const :tag "Default" nil) (repeat :tag "Custom standards" (string :tag "Standard name"))) - :group 'flymake-rest) + :group 'flymake-collection) -(defcustom flymake-rest-luacheck-rc nil ; ".luacheckrc" +(defcustom flymake-collection-luacheck-rc nil ; ".luacheckrc" "Optional configuration file for luacheck." :type '(choice (const :tag "Default" nil) (file :tag "Config file")) - :group 'flymake-rest) + :group 'flymake-collection) -;;;###autoload (autoload 'flymake-rest-luacheck "flymake-rest-luacheck") -(flymake-rest-define-rx flymake-rest-luacheck +;;;###autoload (autoload 'flymake-collection-luacheck "flymake-collection-luacheck") +(flymake-collection-define-rx flymake-collection-luacheck "A Lua syntax checker using luacheck. See URL `https://github.com/mpeterv/luacheck'." @@ -63,12 +63,12 @@ See URL `https://github.com/mpeterv/luacheck'." "--formatter" "plain" "--codes" ; Show warning codes "--no-color" - ,@(when flymake-rest-luacheck-standards + ,@(when flymake-collection-luacheck-standards (list "--std" - (mapconcat #'identity flymake-rest-luacheck-standards "+"))) - ,@(when flymake-rest-luacheck-rc - (list "--config" flymake-rest-luacheck-rc)) - ,@(when-let ((file (buffer-file-name flymake-rest-source))) + (mapconcat #'identity flymake-collection-luacheck-standards "+"))) + ,@(when flymake-collection-luacheck-rc + (list "--config" flymake-collection-luacheck-rc)) + ,@(when-let ((file (buffer-file-name flymake-collection-source))) (list "--filename" file)) "-") :regexps @@ -76,6 +76,6 @@ See URL `https://github.com/mpeterv/luacheck'." ((warning bol (optional (file-name)) ":" line ":" column ":" " (" (id "W" (one-or-more digit)) ") " (message) eol) (error bol (optional (file-name)) ":" line ":" column ":" (optional " (" (id "E" (one-or-more digit)) ") ") (message) eol))) -(provide 'flymake-rest-luacheck) +(provide 'flymake-collection-luacheck) -;;; flymake-rest-luacheck.el ends here +;;; flymake-collection-luacheck.el ends here diff --git a/checkers/flymake-rest-markdownlint.el b/src/checkers/flymake-collection-markdownlint.el similarity index 72% rename from checkers/flymake-rest-markdownlint.el rename to src/checkers/flymake-collection-markdownlint.el index 200ea6bd8e..9f7591bf1f 100644 --- a/checkers/flymake-rest-markdownlint.el +++ b/src/checkers/flymake-collection-markdownlint.el @@ -1,4 +1,4 @@ -;;; flymake-rest-markdownlint.el --- Markdownlint diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-markdownlint.el --- Markdownlint diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,18 +27,18 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -(defcustom flymake-rest-markdownlint-style nil +(defcustom flymake-collection-markdownlint-style nil "Path to the style config for markdownlint." :type 'string - :group 'flymake-rest) + :group 'flymake-collection) -;;;###autoload (autoload 'flymake-rest-markdownlint "flymake-rest-markdownlint") -(flymake-rest-define-rx flymake-rest-markdownlint +;;;###autoload (autoload 'flymake-collection-markdownlint "flymake-collection-markdownlint") +(flymake-collection-define-rx flymake-collection-markdownlint "Markdown checker using mdl. See URL `https://github.com/markdownlint/markdownlint'." @@ -48,11 +48,11 @@ See URL `https://github.com/markdownlint/markdownlint'." (error "Cannot find mdl executable")) :write-type 'pipe :command `(,mdl-exec - ,@(and flymake-rest-markdownlint-style - `("--style" ,flymake-rest-markdownlint-style))) + ,@(and flymake-collection-markdownlint-style + `("--style" ,flymake-collection-markdownlint-style))) :regexps ((error bol "(stdin):" line ": " (id "MD" (+ digit)) " " (message) eol))) -(provide 'flymake-rest-markdownlint) +(provide 'flymake-collection-markdownlint) -;;; flymake-rest-markdownlint.el ends here +;;; flymake-collection-markdownlint.el ends here diff --git a/checkers/flymake-rest-mypy.el b/src/checkers/flymake-collection-mypy.el similarity index 82% rename from checkers/flymake-rest-mypy.el rename to src/checkers/flymake-collection-mypy.el index 6b2ef64089..1fa8f27444 100644 --- a/checkers/flymake-rest-mypy.el +++ b/src/checkers/flymake-collection-mypy.el @@ -1,4 +1,4 @@ -;;; flymake-rest-mypy.el --- MyPy diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-mypy.el --- MyPy diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-mypy "flymake-rest-mypy") -(flymake-rest-define-rx flymake-rest-mypy +;;;###autoload (autoload 'flymake-collection-mypy "flymake-collection-mypy") +(flymake-collection-define-rx flymake-collection-mypy "Mypy syntax and type checker. Requires mypy>=0.580. See URL `http://mypy-lang.org/'." @@ -49,12 +49,12 @@ See URL `http://mypy-lang.org/'." "--no-color-output" "--show-absolute-path" "--show-error-codes" - flymake-rest-temp-file) + flymake-collection-temp-file) :regexps ((error bol (file-name) ":" line ":" column ": error: " (message) eol) (warning bol (file-name) ":" line ":" column ": warning: " (message) eol) (note bol (file-name) ":" line ":" column ": note: " (message) eol))) -(provide 'flymake-rest-mypy) +(provide 'flymake-collection-mypy) -;;; flymake-rest-mypy.el ends here +;;; flymake-collection-mypy.el ends here diff --git a/checkers/flymake-rest-proselint.el b/src/checkers/flymake-collection-proselint.el similarity index 76% rename from checkers/flymake-rest-proselint.el rename to src/checkers/flymake-collection-proselint.el index 399ebf6b37..ac2162b6ec 100644 --- a/checkers/flymake-rest-proselint.el +++ b/src/checkers/flymake-collection-proselint.el @@ -1,4 +1,4 @@ -;;; flymake-rest-proselint.el --- Proselint diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-proselint.el --- Proselint diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-proselint "flymake-rest-proselint") -(flymake-rest-define-enumerate flymake-rest-proselint +;;;###autoload (autoload 'flymake-collection-proselint "flymake-collection-proselint") +(flymake-collection-define-enumerate flymake-collection-proselint "Flymake checker using Proselint. See URL `http://proselint.com/'." @@ -47,20 +47,20 @@ See URL `http://proselint.com/'." (alist-get 'errors (alist-get 'data (car - (flymake-rest-parse-json + (flymake-collection-parse-json (buffer-substring-no-properties (point-min) (point-max)))))) :enumerate-parser (let-alist it - (list flymake-rest-source + (list flymake-collection-source .start .end (pcase .severity ("suggestion" :note) ("warning" :warning) ((or "error" _) :error)) - (concat (propertize .check 'face 'flymake-rest-diag-id) " " .message)))) + (concat (propertize .check 'face 'flymake-collection-diag-id) " " .message)))) -(provide 'flymake-rest-proselint) +(provide 'flymake-collection-proselint) -;;; flymake-rest-proselint.el ends here +;;; flymake-collection-proselint.el ends here diff --git a/checkers/flymake-rest-pycodestyle.el b/src/checkers/flymake-collection-pycodestyle.el similarity index 77% rename from checkers/flymake-rest-pycodestyle.el rename to src/checkers/flymake-collection-pycodestyle.el index fb785297c2..ca2a25aa3e 100644 --- a/checkers/flymake-rest-pycodestyle.el +++ b/src/checkers/flymake-collection-pycodestyle.el @@ -1,4 +1,4 @@ -;;; flymake-rest-pycodestyle.el --- Pycodestyle diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-pycodestyle.el --- Pycodestyle diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-pycodestyle "flymake-rest-pycodestyle") -(flymake-rest-define-rx flymake-rest-pycodestyle +;;;###autoload (autoload 'flymake-collection-pycodestyle "flymake-collection-pycodestyle") +(flymake-collection-define-rx flymake-collection-pycodestyle "Python style guide checker. See URL `https://github.com/PyCQA/pycodestyle'." @@ -44,10 +44,10 @@ See URL `https://github.com/PyCQA/pycodestyle'." (error "Cannot find pycodestyle executable")) :write-type 'file :source-inplace t - :command (list pycodestyle-exec flymake-rest-temp-file) + :command (list pycodestyle-exec flymake-collection-temp-file) :regexps ((error bol (file-name) ":" line ":" column ": " (id (or "E" "W") (one-or-more digit)) " " (message) eol))) -(provide 'flymake-rest-pycodestyle) +(provide 'flymake-collection-pycodestyle) -;;; flymake-rest-pycodestyle.el ends here +;;; flymake-collection-pycodestyle.el ends here diff --git a/checkers/flymake-rest-pylint.el b/src/checkers/flymake-collection-pylint.el similarity index 76% rename from checkers/flymake-rest-pylint.el rename to src/checkers/flymake-collection-pylint.el index 65a3015c1f..e9ea1bb8a5 100644 --- a/checkers/flymake-rest-pylint.el +++ b/src/checkers/flymake-collection-pylint.el @@ -1,4 +1,4 @@ -;;; flymake-rest-pylint.el --- Pylint diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-pylint.el --- Pylint diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-pylint "flymake-rest-pylint") -(flymake-rest-define-enumerate flymake-rest-pylint +;;;###autoload (autoload 'flymake-collection-pylint "flymake-collection-pylint") +(flymake-collection-define-enumerate flymake-collection-pylint "A Python syntax and style checker using Pylint. This syntax checker requires Pylint 1.0 or newer. @@ -42,7 +42,7 @@ See URL `https://www.pylint.org/'." :title "pylint" :pre-let ((python-exec (executable-find "python3")) (pylint-exec (executable-find "pylint")) - (file-name (or (buffer-file-name flymake-rest-source) + (file-name (or (buffer-file-name flymake-collection-source) "_"))) :pre-check (progn @@ -59,13 +59,13 @@ See URL `https://www.pylint.org/'." file-name) :generator (car - (flymake-rest-parse-json + (flymake-collection-parse-json (buffer-substring-no-properties (point-min) (point-max)))) :enumerate-parser (let-alist it - (let ((loc (flymake-diag-region flymake-rest-source .line .column))) - (list flymake-rest-source + (let ((loc (flymake-diag-region flymake-collection-source .line .column))) + (list flymake-collection-source (car loc) (cdr loc) (pcase .type @@ -73,8 +73,8 @@ See URL `https://www.pylint.org/'." ((or "fatal" "error") :error) ((or "warning" "refactor" "convention") :warning) ((or "info" _) :note)) - (concat (propertize .message-id 'face 'flymake-rest-diag-id) " " .message))))) + (concat (propertize .message-id 'face 'flymake-collection-diag-id) " " .message))))) -(provide 'flymake-rest-pylint) +(provide 'flymake-collection-pylint) -;;; flymake-rest-pylint.el ends here +;;; flymake-collection-pylint.el ends here diff --git a/checkers/flymake-rest-rubocop.el b/src/checkers/flymake-collection-rubocop.el similarity index 82% rename from checkers/flymake-rest-rubocop.el rename to src/checkers/flymake-collection-rubocop.el index 1cbb4fc4e0..bb20ddbd95 100644 --- a/checkers/flymake-rest-rubocop.el +++ b/src/checkers/flymake-collection-rubocop.el @@ -1,4 +1,4 @@ -;;; flymake-rest-rubocop.el --- Rubocop diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-rubocop.el --- Rubocop diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,32 +27,32 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -(defcustom flymake-rest-rubocop-use-bundler t +(defcustom flymake-collection-rubocop-use-bundler t "When true use bundle exec for rubocop checks." :type 'boolean - :group 'flymake-rest) + :group 'flymake-collection) -;;;###autoload (autoload 'flymake-rest-rubocop "flymake-rest-rubocop") -(flymake-rest-define-rx flymake-rest-rubocop +;;;###autoload (autoload 'flymake-collection-rubocop "flymake-collection-rubocop") +(flymake-collection-define-rx flymake-collection-rubocop "A Ruby syntax checker using rubocop. See URL `https://github.com/rubocop/rubocop'." :title "rubocop" :pre-let ((rubocop-exec (executable-find "rubocop")) - (file-name (or (buffer-file-name flymake-rest-source) + (file-name (or (buffer-file-name flymake-collection-source) "-"))) :pre-check (unless rubocop-exec (error "Cannot find rubocop executable")) :write-type 'pipe - :command `(,@(or (and flymake-rest-rubocop-use-bundler - (locate-dominating-file (or (buffer-file-name flymake-rest-source) + :command `(,@(or (and flymake-collection-rubocop-use-bundler + (locate-dominating-file (or (buffer-file-name flymake-collection-source) (buffer-local-value 'default-directory - flymake-rest-source) + flymake-collection-source) default-directory) "Gemfile") (if-let ((bundler-exec (executable-find "bundler"))) @@ -76,6 +76,6 @@ See URL `https://github.com/rubocop/rubocop'." (warning bol (file-name) ":" line ":" column ": " "C" ": " (? "[Correctable] ") (message) eol) (note bol (file-name) ":" line ":" column ": " "W" ": " (? "[Correctable] ") (message) eol))) -(provide 'flymake-rest-rubocop) +(provide 'flymake-collection-rubocop) -;;; flymake-rest-rubocop.el ends here +;;; flymake-collection-rubocop.el ends here diff --git a/checkers/flymake-rest-shellcheck.el b/src/checkers/flymake-collection-shellcheck.el similarity index 70% rename from checkers/flymake-rest-shellcheck.el rename to src/checkers/flymake-collection-shellcheck.el index e8d626f03b..fb5524412b 100644 --- a/checkers/flymake-rest-shellcheck.el +++ b/src/checkers/flymake-collection-shellcheck.el @@ -1,4 +1,4 @@ -;;; flymake-rest-shellcheck.el --- Shellcheck diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-shellcheck.el --- Shellcheck diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,20 +27,20 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -(defcustom flymake-rest-shellcheck-follow-sources t - "Whether to follow sources in `flymake-rest-shellcheck'." +(defcustom flymake-collection-shellcheck-follow-sources t + "Whether to follow sources in `flymake-collection-shellcheck'." :type '(choice (const :tag "Follow source files" t) (const :tag "Follow source files and lint them" lint) (const :tag "Do not follow source files" nil)) - :group 'flymake-rest) + :group 'flymake-collection) -;;;###autoload (autoload 'flymake-rest-shellcheck "flymake-rest-shellcheck") -(flymake-rest-define-enumerate flymake-rest-shellcheck +;;;###autoload (autoload 'flymake-collection-shellcheck "flymake-collection-shellcheck") +(flymake-collection-define-enumerate flymake-collection-shellcheck "A shell script syntax and style checker using Shellcheck. See URL `https://github.com/koalaman/shellcheck/'." @@ -53,29 +53,29 @@ See URL `https://github.com/koalaman/shellcheck/'." "--format" "json" ,@(when-let ((sh (bound-and-true-p sh-shell))) `("--shell" ,(symbol-name sh))) - ,@(when flymake-rest-shellcheck-follow-sources + ,@(when flymake-collection-shellcheck-follow-sources `("--external-sources" - ,@(when (eq flymake-rest-shellcheck-follow-sources 'lint) + ,@(when (eq flymake-collection-shellcheck-follow-sources 'lint) '("--check-sourced")))) "-") :generator (car - (flymake-rest-parse-json + (flymake-collection-parse-json (buffer-substring-no-properties (point-min) (point-max)))) :enumerate-parser (let-alist it - (let ((loc (cons (car (flymake-diag-region flymake-rest-source .line .column)) - (cdr (flymake-diag-region flymake-rest-source .endLine .endColumn))))) - (list flymake-rest-source + (let ((loc (cons (car (flymake-diag-region flymake-collection-source .line .column)) + (cdr (flymake-diag-region flymake-collection-source .endLine .endColumn))))) + (list flymake-collection-source (car loc) (cdr loc) (pcase .level ("error" :error) ("warning" :warning) ((or "info" "style" _) :note)) - (concat (propertize (format "SC%s" .code) 'face 'flymake-rest-diag-id) " " .message))))) + (concat (propertize (format "SC%s" .code) 'face 'flymake-collection-diag-id) " " .message))))) -(provide 'flymake-rest-shellcheck) +(provide 'flymake-collection-shellcheck) -;;; flymake-rest-shellcheck.el ends here +;;; flymake-collection-shellcheck.el ends here diff --git a/checkers/flymake-rest-sql-lint.el b/src/checkers/flymake-collection-sql-lint.el similarity index 75% rename from checkers/flymake-rest-sql-lint.el rename to src/checkers/flymake-collection-sql-lint.el index 0de3044351..4d38018c73 100644 --- a/checkers/flymake-rest-sql-lint.el +++ b/src/checkers/flymake-collection-sql-lint.el @@ -1,4 +1,4 @@ -;;; flymake-rest-sql-lint.el --- SQL diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-sql-lint.el --- SQL diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,21 +27,21 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -(defcustom flymake-rest-sql-lint-driver nil +(defcustom flymake-collection-sql-lint-driver nil "The SQL driver to pass to sql-lint." :type '(choice (const :tag "Default" nil) (const :tag "MySQL" "mysql") (const :tag "PostgreSQL" "postgres")) - :group 'flymake-rest) + :group 'flymake-collection) -;;;###autoload (autoload 'flymake-rest-sql-lint "flymake-rest-sql-lint") -(flymake-rest-define-rx flymake-rest-sql-lint +;;;###autoload (autoload 'flymake-collection-sql-lint "flymake-collection-sql-lint") +(flymake-collection-define-rx flymake-collection-sql-lint "A SQL syntax checker using the sql-lint tool. See URL `https://github.com/joereynolds/sql-lint'." @@ -51,11 +51,11 @@ See URL `https://github.com/joereynolds/sql-lint'." (error "Cannot find sql-lint executable")) :write-type 'pipe :command `(,lint-exec - ,@(when flymake-rest-sql-lint-driver - `("--driver" ,flymake-rest-sql-lint-driver))) + ,@(when flymake-collection-sql-lint-driver + `("--driver" ,flymake-collection-sql-lint-driver))) :regexps ((warning bol "stdin:" line " [sql-lint: " (id (one-or-more (any alnum "-"))) "] " (message) eol))) -(provide 'flymake-rest-sql-lint) +(provide 'flymake-collection-sql-lint) -;;; flymake-rest-sql-lint.el ends here +;;; flymake-collection-sql-lint.el ends here diff --git a/checkers/flymake-rest-sqlint.el b/src/checkers/flymake-collection-sqlint.el similarity index 83% rename from checkers/flymake-rest-sqlint.el rename to src/checkers/flymake-collection-sqlint.el index 1848eae120..a9d8bca33c 100644 --- a/checkers/flymake-rest-sqlint.el +++ b/src/checkers/flymake-collection-sqlint.el @@ -1,4 +1,4 @@ -;;; flymake-rest-sqlint.el --- SQL diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-sqlint.el --- SQL diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-sqlint "flymake-rest-sqlint") -(flymake-rest-define-rx flymake-rest-sqlint +;;;###autoload (autoload 'flymake-collection-sqlint "flymake-collection-sqlint") +(flymake-collection-define-rx flymake-collection-sqlint "A SQL syntax checker using the sqlint tool. See URL `https://github.com/purcell/sqlint'." @@ -57,7 +57,7 @@ See URL `https://github.com/purcell/sqlint'." (one-or-more not-newline))) eol))) -(provide 'flymake-rest-sqlint) +(provide 'flymake-collection-sqlint) -;;; flymake-rest-sqlint.el ends here +;;; flymake-collection-sqlint.el ends here diff --git a/checkers/flymake-rest-xmllint.el b/src/checkers/flymake-collection-xmllint.el similarity index 81% rename from checkers/flymake-rest-xmllint.el rename to src/checkers/flymake-collection-xmllint.el index d4356dbb92..66cad50de2 100644 --- a/checkers/flymake-rest-xmllint.el +++ b/src/checkers/flymake-collection-xmllint.el @@ -1,4 +1,4 @@ -;;; flymake-rest-xmllint.el --- XML diagnostic function -*- lexical-binding: t; -*- +;;; flymake-collection-xmllint.el --- XML diagnostic function -*- lexical-binding: t; -*- ;; Copyright (C) 2021 mohsin kaleem @@ -27,13 +27,13 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest) +(require 'flymake-collection) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-xmllint "flymake-rest-xmllint") -(flymake-rest-define-rx flymake-rest-xmllint +;;;###autoload (autoload 'flymake-collection-xmllint "flymake-collection-xmllint") +(flymake-collection-define-rx flymake-collection-xmllint "A XML syntax checker and validator using the xmllint utility. The xmllint is part of libxml2, see URL `http://www.xmlsoft.org/'." @@ -47,6 +47,6 @@ The xmllint is part of libxml2, see URL `http://www.xmlsoft.org/'." :regexps ((error bol "-:" line ": " (message) eol))) -(provide 'flymake-rest-xmllint) +(provide 'flymake-collection-xmllint) -;;; flymake-rest-xmllint.el ends here +;;; flymake-collection-xmllint.el ends here diff --git a/checkers/flymake-rest-yamllint.el b/src/checkers/flymake-collection-yamllint.el similarity index 82% rename from checkers/flymake-rest-yamllint.el rename to src/checkers/flymake-collection-yamllint.el index 7a2d83e8e0..e2de9ed093 100644 --- a/checkers/flymake-rest-yamllint.el +++ b/src/checkers/flymake-collection-yamllint.el @@ -1,4 +1,4 @@ -;;; flymake-rest-yamllint.el --- Yamllint diagnostic function -*- lexical-binding: t -*- +;;; flymake-collection-yamllint.el --- Yamllint diagnostic function -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -29,10 +29,10 @@ (require 'flymake) (eval-when-compile - (require 'flymake-rest-define)) + (require 'flymake-collection-define)) -;;;###autoload (autoload 'flymake-rest-yamllint "flymake-rest-yamllint") -(flymake-rest-define-rx flymake-rest-yamllint +;;;###autoload (autoload 'flymake-collection-yamllint "flymake-collection-yamllint") +(flymake-collection-define-rx flymake-collection-yamllint "A YAML syntax checker using YAMLLint. See URL `https://github.com/adrienverge/yamllint'." @@ -46,6 +46,6 @@ See URL `https://github.com/adrienverge/yamllint'." ((error bol "stdin:" line ":" column ": " "[error] " (message) eol) (warning bol "stdin:" line ":" column ": " "[warning] " (message) eol))) -(provide 'flymake-rest-yamllint) +(provide 'flymake-collection-yamllint) -;;; flymake-rest-yamllint.el ends here +;;; flymake-collection-yamllint.el ends here diff --git a/flymake-rest-commands.el b/src/flymake-collection-commands.el similarity index 80% rename from flymake-rest-commands.el rename to src/flymake-collection-commands.el index fd9e8965e8..352d38c5b6 100644 --- a/flymake-rest-commands.el +++ b/src/flymake-collection-commands.el @@ -1,4 +1,4 @@ -;;; flymake-rest-commands.el --- Helpful commands for working with flymake-rest -*- lexical-binding: t -*- +;;; flymake-collection-commands.el --- Helpful commands for working with flymake-collection -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -28,18 +28,18 @@ ;;; Code: (require 'flymake) -(require 'flymake-rest-hook) +(require 'flymake-collection-hook) -(defun flymake-rest-change-checker--cands (all-modes) - "Candidates for `flymake-rest-change-checker'. +(defun flymake-collection-change-checker--cands (all-modes) + "Candidates for `flymake-collection-change-checker'. With ALL-MODES fetch all registered flymake checkers even when they aren't associated with the current mode." (let ((configured-checkers (flymake--collect #'identity))) (cl-remove-duplicates (cl-loop for (mode . checkers) in (if all-modes - flymake-rest-config - (list (assoc major-mode flymake-rest-config))) + flymake-collection-config + (list (assoc major-mode flymake-collection-config))) append (cl-loop for it in checkers with checker = nil @@ -53,10 +53,10 @@ they aren't associated with the current mode." mode checker exists))) :test (lambda (a b) (string-equal (car a) (car b)))))) -(defun flymake-rest-change-checker--read-checkers (&optional all-modes) +(defun flymake-collection-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)) +See `flymake-collection-change-checker--cands' for a description of ALL-MODES." + (let* ((cands (flymake-collection-change-checker--cands all-modes)) (group-function (lambda (cand transform) (if transform cand @@ -81,12 +81,12 @@ See `flymake-rest-change-checker--cands' for a description of ALL-MODES." nil t)))) ;;;###autoload -(defun flymake-rest-change-checker (checkers) +(defun flymake-collection-change-checker (checkers) "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))) + (flymake-collection-change-checker--read-checkers current-prefix-arg))) (when checkers (dolist (checker checkers) (cl-destructuring-bind (_cand _mode checker exists) checker @@ -102,6 +102,8 @@ With `current-prefix-arg' select a checker regardless of `major-mode'." (when (called-interactively-p 'interactive) (flymake-start))))) -(provide 'flymake-rest-commands) +(define-obsolete-function-alias 'flymake-rest-change-checker 'flymake-collection-change-checker "2.0.0") -;;; flymake-rest-commands.el ends here +(provide 'flymake-collection-commands) + +;;; flymake-collection-commands.el ends here diff --git a/flymake-rest-define.el b/src/flymake-collection-define.el similarity index 83% rename from flymake-rest-define.el rename to src/flymake-collection-define.el index c509550085..27ff03abe3 100644 --- a/flymake-rest-define.el +++ b/src/flymake-collection-define.el @@ -1,4 +1,4 @@ -;;; flymake-rest-define.el --- A macro to simplify checker creation -*- lexical-binding: t -*- +;;; flymake-collection-define.el --- A macro to simplify checker creation -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -22,7 +22,7 @@ ;;; Commentary: -;; This file provides a macro `flymake-rest-define', adapted heavily from +;; This file provides a macro `flymake-collection-define', adapted heavily from ;; [[https://github.com/karlotness/flymake-quickdef/blob/150c5839768a3d32f988f9dc08052978a68f2ad7/flymake-quickdef.el][flymake-quickdef]], to allow streamlined syntax-checker definitions. The ;; intended purpose is to abstract the process creation, management and cleanup ;; for a checker as much as possible, leaving the developer to only have to @@ -31,14 +31,14 @@ ;; Also in this file you'll find helper macros to parse diagnostics using ;; regexps and simplify JSON processing. ;; -;; `flymake-rest-define-rx' works by defining some regular expressions (one for +;; `flymake-collection-define-rx' works by defining some regular expressions (one for ;; each severity level of the checker) and then matching each line of the output ;; to a regular expression. Special capture groups have been setup by the parser ;; that should be used by any calling checkers to ensure the correct fields from ;; the output can be parsed. The approach for this was heavily inspired by ;; flychecks :error-parsers feature. ;; -;; `flymake-rest-define' can be used to parse JSON output from the checker into +;; `flymake-collection-define' can be used to parse JSON output from the checker into ;; flymake diagnostics. This works by parsing the entire JSON input into a list ;; of diagnostic related data, and then iteratively parsing it into diagnostics. @@ -48,7 +48,7 @@ (require 'flymake) ;;;###autoload -(defvar-local flymake-rest-define--procs nil +(defvar-local flymake-collection-define--procs nil "The local plist of checker processes running in the current buffer. When a checker process is begun its pushed into this plist and when its finished its removed and killed. In the very often circumstance where a @@ -56,9 +56,11 @@ new check is begun while an old check is still pending, the old check is killed and replaced with the new check.") -;;; `flymake-rest-define' +;;; `flymake-collection-define' -(defun flymake-rest-define--temp-file (temp-dir temp-file source-inplace) +(define-obsolete-function-alias 'flymake-rest-define 'flymake-collection-define "2.0.0") + +(defun flymake-collection-define--temp-file (temp-dir temp-file source-inplace) "Let forms for defining a temporary directory and file. TEMP-DIR and TEMP-FILE are the symbols used for the corresponding variables. SOURCE-INPLACE specifies whether the TEMP-DIR should be in the same working @@ -84,12 +86,12 @@ doesn't exist: %s" dir)) (buffer-name))))) (make-temp-file ".flymake_" nil (concat "_" basename)))))) -(defmacro flymake-rest-define--parse-diags +(defmacro flymake-collection-define--parse-diags (title proc-symb diags-symb current-diag-symb source-symb error-parser) "Helper macro to parse diagnostics into DIAGS-SYMB. TITLE is the title of the current syntax checker. PROC-SYMB, DIAGS-SYMB, CURRENT-DIAGS-SYMB, SOURCE-SYMB, ERROR-PARSER are all described in -`flymake-rest-define'." +`flymake-collection-define'." `(with-current-buffer ,source-symb (save-restriction (widen) @@ -112,7 +114,7 @@ CURRENT-DIAGS-SYMB, SOURCE-SYMB, ERROR-PARSER are all described in (nth 4 ,current-diag-symb) ,(concat " (" - (propertize title 'face 'flymake-rest-checker) + (propertize title 'face 'flymake-collection-checker) ")"))))) (push (apply #'flymake-make-diagnostic ,current-diag-symb) @@ -127,7 +129,7 @@ CURRENT-DIAGS-SYMB, SOURCE-SYMB, ERROR-PARSER are all described in ;; WARN: I can't seem to make docstring optional and use keys, because ;; the key for the first keyword argument will become the docstring if ;; there's no docstring. -(cl-defmacro flymake-rest-define +(cl-defmacro flymake-collection-define (name docstring &optional &key title command error-parser write-type source-inplace pre-let pre-check) @@ -141,13 +143,13 @@ Available Variables Within the body of NAME several macro specific variables will be made available for use with ERROR-PARSER or COMMAND, and other optional arguments such as PRE-LET. This includes: -* flymake-rest-source +* flymake-collection-source The the buffer where the syntax check originally began. -* flymake-rest-temp-file +* flymake-collection-temp-file A temporary file where the contents of the current buffer were written (only if WRITE-TYPE is 'file) -* flymake-rest-temp-dir - The dirname of flymake-rest-temp-file. +* flymake-collection-temp-dir + The dirname of flymake-collection-temp-file. Body Execution -------------- @@ -161,8 +163,8 @@ used to suffix the message for each diagnostic. WRITE-TYPE specifies how the process for a syntax check should recieve the input. It should one of 'pipe or 'file (defaulting to 'pipe). When set to 'file a temporary file will ve created, copying the contents -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 +of the `current-buffer'. The variable flymake-collection-temp-file and +flymake-collection-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. @@ -193,7 +195,7 @@ a value that can be passed to the `flymake-make-diagnostic' function. Once there're no more diagnostics to parse this form should evaluate to nil." (declare (indent defun) (doc-string 2)) (unless lexical-binding - (error "Need lexical-binding for flymake-rest-define (%s)" name)) + (error "Need lexical-binding for flymake-collection-define (%s)" name)) (dolist (elem (list (cons 'command command) (cons 'error-parser error-parser))) (unless (cdr elem) @@ -205,11 +207,11 @@ there're no more diagnostics to parse this form should evaluate to nil." (unless (memq write-type '(file pipe)) (error "Invalid `:write-type' value `%s'" write-type)) - (let* ((temp-dir-symb 'flymake-rest-temp-dir) - (temp-file-symb 'flymake-rest-temp-file) + (let* ((temp-dir-symb 'flymake-collection-temp-dir) + (temp-file-symb 'flymake-collection-temp-file) (proc-symb 'proc) - (err-symb 'flymake-rest-err) - (source-symb 'flymake-rest-source) + (err-symb 'flymake-collection-err) + (source-symb 'flymake-collection-source) (diags-symb 'diags) (current-diag-symb 'diag) (cleanup-form (when (eq write-type 'file) @@ -218,14 +220,14 @@ there're no more diagnostics to parse this form should evaluate to nil." `((delete-directory ,temp-dir-symb t))))) (not-obsolete-form `((eq ,proc-symb - (plist-get (buffer-local-value 'flymake-rest-define--procs + (plist-get (buffer-local-value 'flymake-collection-define--procs ,source-symb) ',name))))) `(defun ,name (report-fn &rest _args) ,docstring (let* ((,source-symb (current-buffer)) ,@(when (eq write-type 'file) - (flymake-rest-define--temp-file + (flymake-collection-define--temp-file temp-dir-symb temp-file-symb source-inplace)) ,@pre-let) ;; With vars defined, do pre-check. @@ -235,7 +237,7 @@ there're no more diagnostics to parse this form should evaluate to nil." (error ,@cleanup-form (signal (car ,err-symb) (cdr ,err-symb)))))) ;; Kill any running (obsolete) checkers for current checker and buffer. - (let ((,proc-symb (plist-get flymake-rest-define--procs ',name))) + (let ((,proc-symb (plist-get flymake-collection-define--procs ',name))) (when (process-live-p ,proc-symb) (flymake-log :debug "Killing earlier checker process %s" ,proc-symb) (kill-process ,proc-symb))) @@ -262,7 +264,7 @@ there're no more diagnostics to parse this form should evaluate to nil." (unwind-protect (if ,@not-obsolete-form (let ((,diags-symb nil) ,current-diag-symb) - (flymake-rest-define--parse-diags + (flymake-collection-define--parse-diags ,title ,proc-symb ,diags-symb @@ -293,8 +295,8 @@ exit status %d\nStderr: %s" ,@cleanup-form (kill-buffer (process-buffer ,proc-symb))))))) ;; Push the new-process to the process to the process alist. - (setq flymake-rest-define--procs - (plist-put flymake-rest-define--procs ',name ,proc-symb)) + (setq flymake-collection-define--procs + (plist-put flymake-collection-define--procs ',name ,proc-symb)) ;; If piping, send data to the process. ,@(when (eq write-type 'pipe) `((process-send-region ,proc-symb (point-min) (point-max)) @@ -303,12 +305,15 @@ exit status %d\nStderr: %s" ,proc-symb)))))) -;;; `flymake-rest-define-rx' +;;; `flymake-collection-define-rx' (eval-when-compile (require 'rx)) -(defconst flymake-rest-define-parse-rx-constituents +(define-obsolete-variable-alias 'flymake-rest-define-parse-rx-constituents 'flymake-collection-define-parse-rx-constituents "2.0.0") +(define-obsolete-function-alias 'flymake-rest-define-rx 'flymake-collection-define-rx "2.0.0") + +(defconst flymake-collection-define-parse-rx-constituents `((file-name ,(lambda (body) (rx-to-string `(group-n 1 ,@(or (cdr body) @@ -331,8 +336,8 @@ exit status %d\nStderr: %s" (end-line . ,(rx (group-n 6 (one-or-more digit)))) (end-column . ,(rx (group-n 7 (one-or-more digit)))))) -(defmacro flymake-rest-define--parse-rx (regexps) - "`flymake-rest-define' parser using regular expressions. +(defmacro flymake-collection-define--parse-rx (regexps) + "`flymake-collection-define' parser using regular expressions. This macro generates a parser that for each line of output from the checker process, matches one or more regular expressions and then @@ -345,7 +350,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-define-parse-rx-constituents'. +line. For a list of these see `flymake-collection-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. @@ -355,11 +360,11 @@ the special ones described above. This is because any extra capture groups are used to associate the severity of the diagnostic to the regexp that matched it (as a performance improvement). -For an example of this macro in action, see `flymake-rest-pycodestyle'." +For an example of this macro in action, see `flymake-collection-pycodestyle'." (unless (> (length regexps) 0) (error "Must supply at least one regexp for error, warning or note")) - (let* ((group-count (length flymake-rest-define-parse-rx-constituents)) + (let* ((group-count (length flymake-collection-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,12 +376,12 @@ 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-define-parse-rx-constituents + (let ((rx-constituents (append flymake-collection-define-parse-rx-constituents (bound-and-true-p rx-constituents) nil))) (rx-to-string `(or ,@(mapcar #'car regexps)) 'no-group))) (severity-seq (mapcar #'cdr regexps))) - ;; Because if this evaluates to nil `flymake-rest-define' thinks there + ;; Because if this evaluates to nil `flymake-collection-define' thinks there ;; are no-more diagnostics to be parsed, we wrap it in a loop that exits ;; the moment we find a match, but otherwise keeps moving through diagnostics ;; until there actually aren't any more to match. @@ -410,38 +415,38 @@ For an example of this macro in action, see `flymake-rest-pycodestyle'." (symbol-name it))) nil)) (t - (let ((loc (flymake-diag-region flymake-rest-source + (let ((loc (flymake-diag-region flymake-collection-source (string-to-number line) (when column (string-to-number column)))) (loc-end (when end-line - (flymake-diag-region flymake-rest-source + (flymake-diag-region flymake-collection-source (string-to-number end-line) (when end-column (string-to-number end-column)))))) (when loc-end (setcdr loc (cdr loc-end))) - (list flymake-rest-source + (list flymake-collection-source (car loc) (cdr loc) (nth severity-ix (quote ,severity-seq)) (concat (when id - (concat (propertize id 'face 'flymake-rest-diag-id) " ")) + (concat (propertize id 'face 'flymake-collection-diag-id) " ")) message))))))))) res))) -(cl-defmacro flymake-rest-define-rx +(cl-defmacro flymake-collection-define-rx (name docstring &optional &key title command write-type source-inplace pre-let pre-check regexps) - "`flymake-rest-define' helper using `rx' syntax to parse diagnostics. -This helper macro adapts `flymake-rest-define' to use an error-parser built -from a collections of REGEXPS (see `flymake-rest-define--parse-rx'). + "`flymake-collection-define' helper using `rx' syntax to parse diagnostics. +This helper macro adapts `flymake-collection-define' to use an error-parser +built from a collections of REGEXPS (see `flymake-collection-define--parse-rx'). -See `flymake-rest-define' for a description of NAME, DOCSTRING, TITLE, COMMAND, -WRITE-TYPE, SOURCE-INPLACE, PRE-LET, and PRE-CHECK." +See `flymake-collection-define' for a description of NAME, DOCSTRING, TITLE, +COMMAND,WRITE-TYPE, SOURCE-INPLACE, PRE-LET, and PRE-CHECK." (declare (indent defun) (doc-string 2)) - `(flymake-rest-define ,name + `(flymake-collection-define ,name ,docstring :title ,title :command ,command @@ -450,16 +455,18 @@ WRITE-TYPE, SOURCE-INPLACE, PRE-LET, and PRE-CHECK." :pre-let ,pre-let :pre-check ,pre-check :error-parser - (flymake-rest-define--parse-rx ,regexps))) + (flymake-collection-define--parse-rx ,regexps))) -;;; `flymake-rest-define-enumerate' +;;; `flymake-collection-define-enumerate' + +(define-obsolete-function-alias 'flymake-rest-define-enumerate 'flymake-collection-define-enumerate "2.0.0") -(cl-defmacro flymake-rest-define-enumerate +(cl-defmacro flymake-collection-define-enumerate (name docstring &optional &key title command write-type source-inplace pre-let pre-check generator enumerate-parser) - "`flymake-rest-define' helper for dealing with serialised diagnostics. + "`flymake-collection-define' helper for dealing with serialised diagnostics. This helper parses a collection of diagnostics using GENERATOR and then enumerates through it, entry by entry using ENUMERATE-PARSER. This is useful for linters that produce output such as JSON, to avoid having to reparse the @@ -469,12 +476,12 @@ 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'. -See `flymake-rest-define' for a description of NAME, DOCSTRING, TITLE, COMMAND, -WRITE-TYPE, SOURCE-INPLACE, PRE-LET, and PRE-CHECK." +See `flymake-collection-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)) - `(flymake-rest-define ,name + (let ((entries-var 'flymake-collection-entries) + (parsed-var 'flymake-collection-parsed)) + `(flymake-collection-define ,name ,docstring :title ,title :command ,command @@ -497,6 +504,6 @@ WRITE-TYPE, SOURCE-INPLACE, PRE-LET, and PRE-CHECK." (setq res ,enumerate-parser)) res))))) -(provide 'flymake-rest-define) +(provide 'flymake-collection-define) -;;; flymake-rest-define.el ends here +;;; flymake-collection-define.el ends here diff --git a/flymake-rest-hook.el b/src/flymake-collection-hook.el similarity index 55% rename from flymake-rest-hook.el rename to src/flymake-collection-hook.el index 0534b97f78..a2a03472ff 100644 --- a/flymake-rest-hook.el +++ b/src/flymake-collection-hook.el @@ -1,4 +1,4 @@ -;;; flymake-rest-hook.el --- Support for binding flymake backends to specific modes -*- lexical-binding: t -*- +;;; flymake-collection-hook.el --- Support for binding flymake backends to specific modes -*- lexical-binding: t -*- ;; Copyright (c) 2021 Mohsin Kaleem @@ -29,64 +29,68 @@ (require 'cl-lib) +(define-obsolete-variable-alias 'flymake-rest-config 'flymake-collection-config "2.0.0") +(define-obsolete-variable-alias 'flymake-rest-config-inherit 'flymake-collection-config-inherit "2.0.0") +(define-obsolete-variable-alias 'flymake-rest-hook-ignore-modes 'flymake-collection-hook-ignore-modes "2.0.0") + ;;;###autoload -(defcustom flymake-rest-config +(defcustom flymake-collection-config '((python-mode - flymake-rest-pycodestyle + flymake-collection-pycodestyle (flymake-mypy :disabled t) - (flymake-rest-pylint :disabled t)) - (awk-mode flymake-rest-awk-gawk) + (flymake-collection-pylint :disabled t)) + (awk-mode flymake-collection-awk-gawk) (c-mode - flymake-rest-clang - (flymake-rest-gcc :disabled t)) + flymake-collection-clang + (flymake-collection-gcc :disabled t)) (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) + flymake-collection-clang + (flymake-collection-gcc :disabled t)) + (haskell-mode flymake-collection-hlint) + (js-mode flymake-collection-eslint) + (js2-mode flymake-collection-eslint) + (typescript-mode flymake-collection-eslint) (json-mode - flymake-rest-jq - (flymake-rest-jsonlint :disabled t)) - (less-mode flymake-rest-less) + flymake-collection-jq + (flymake-collection-jsonlint :disabled t)) + (less-mode flymake-collection-less) (markdown-mode - flymake-rest-markdownlint - flymake-rest-proselint) + flymake-collection-markdownlint + flymake-collection-proselint) (lua-mode - flymake-rest-luacheck - (flymake-rest-lua :disabled t)) + flymake-collection-luacheck + (flymake-collection-lua :disabled t)) (sql-mode - flymake-rest-sql-lint - (flymake-rest-sqlint :disabled t)) - (ruby-mode flymake-rest-rubocop) - ;; (hledger-mode flymake-rest-hledger) - (sh-mode flymake-rest-shellcheck) - (yaml-mode flymake-rest-yamllint) - (web-mode flymake-rest-html-tidy) - (org-mode flymake-rest-proselint) - (notmuch-message-mode flymake-rest-proselint) - (nxml-mode flymake-rest-xmllint)) + flymake-collection-sql-lint + (flymake-collection-sqlint :disabled t)) + (ruby-mode flymake-collection-rubocop) + ;; (hledger-mode flymake-collection-hledger) + (sh-mode flymake-collection-shellcheck) + (yaml-mode flymake-collection-yamllint) + (web-mode flymake-collection-html-tidy) + (org-mode flymake-collection-proselint) + (notmuch-message-mode flymake-collection-proselint) + (nxml-mode flymake-collection-xmllint)) "Configuration mapping major-modes to `flymake' backends." :type 'list - :group 'flymake-rest) + :group 'flymake-collection) -(defcustom flymake-rest-config-inherit nil +(defcustom flymake-collection-config-inherit nil "When true diagnostic hooks inherit parent-mode hooks." :type 'boolean - :group 'flymake-rest) + :group 'flymake-collection) -(defun flymake-rest-configured-checkers (mode) +(defun flymake-collection-configured-checkers (mode) "Fetch the list of diagnostic functions configured for MODE." (let (checkers (modes (list mode))) ;; Consider all the parent modes as well. - (when flymake-rest-config-inherit + (when flymake-collection-config-inherit (while (setq mode (get mode 'derived-mode-parent)) (push mode modes))) ;; For each mode populate the checkers alist with (checker . depth). (dolist (mode modes) - (dolist (conf (alist-get mode flymake-rest-config)) + (dolist (conf (alist-get mode flymake-collection-config)) (cond ((symbolp conf) (push (cons conf nil) checkers)) ((consp conf) @@ -99,39 +103,43 @@ (funcall predicate))) (push (cons checker depth) checkers)))) (t - (warn "Unknown checker config in `flymake-rest-config': %s" conf))))) + (warn "Unknown checker config in `flymake-collection-config': %s" conf))))) (nreverse checkers))) -(defcustom flymake-rest-hook-ignore-modes nil - "List of modes in which `flymake-rest-hook' is inhibited." +(defcustom flymake-collection-hook-ignore-modes nil + "List of modes in which `flymake-collection-hook' is inhibited." :type '(list symbol) - :group 'flymake-rest) + :group 'flymake-collection) -(defun flymake-rest-hook-set-backends () - "Setup `flymake-diagnostic-functions' using `flymake-rest-config'." +(defun flymake-collection-hook-set-backends () + "Setup `flymake-diagnostic-functions' using `flymake-collection-config'." (unless (cl-find-if (lambda (mode) (or (eq major-mode mode) (and (boundp mode) (eval mode)))) - flymake-rest-hook-ignore-modes) - (dolist (it (flymake-rest-configured-checkers major-mode)) + flymake-collection-hook-ignore-modes) + (dolist (it (flymake-collection-configured-checkers major-mode)) (add-hook 'flymake-diagnostic-functions (car it) (cdr it) t)))) ;;;###autoload -(defun flymake-rest-hook-setup () +(define-obsolete-function-alias 'flymake-rest-hook-setup 'flymake-collection-hook-setup "2.0.0") +(define-obsolete-function-alias 'flymake-rest-hook-teardown 'flymake-collection-hook-teardown "2.0.0") + +;;;###autoload +(defun flymake-collection-hook-setup () "Setup flymake-hook." - (add-hook 'after-change-major-mode-hook #'flymake-rest-hook-set-backends)) + (add-hook 'after-change-major-mode-hook #'flymake-collection-hook-set-backends)) -(defun flymake-rest-hook-teardown () +(defun flymake-collection-hook-teardown () "Tear down flymake-hook." - (remove-hook 'after-change-major-mode-hook #'flymake-rest-hook-set-backends)) + (remove-hook 'after-change-major-mode-hook #'flymake-collection-hook-set-backends)) ;;; `use-package' integration ;;;###autoload (with-eval-after-load 'use-package-core - (defvar flymake-rest-config) + (defvar flymake-collection-config) (declare-function use-package-concat "use-package-core") (declare-function use-package-process-keywords "use-package-core") @@ -151,9 +159,9 @@ (let ((body (use-package-process-keywords name-symbol rest state))) (use-package-concat (cl-loop for it in hooks - collect `(push (quote ,it) flymake-rest-config)) + collect `(push (quote ,it) flymake-collection-config)) body)))) -(provide 'flymake-rest-hook) +(provide 'flymake-collection-hook) -;;; flymake-rest-hook.el ends here +;;; flymake-collection-hook.el ends here diff --git a/flymake-rest.el b/src/flymake-collection.el similarity index 72% rename from flymake-rest.el rename to src/flymake-collection.el index 7cf2cf9718..5e916f58a0 100644 --- a/flymake-rest.el +++ b/src/flymake-collection.el @@ -1,14 +1,14 @@ -;;; flymake-rest.el --- Core features for flymake -*- lexical-binding: t -*- +;;; flymake-collection.el --- Core features for flymake -*- lexical-binding: t -*- ;; Copyright (C) 2021 Mohsin Kaleem ;; Author: Mohsin Kaleem <mohk...@kisara.moe> ;; Created: 15 June 2021 -;; Homepage: https://github.com/mohkale/flymake-rest +;; Homepage: https://github.com/mohkale/flymake-collection ;; Keywords: language tools ;; Package-Requires: ((emacs "28.1") (let-alist "1.0") (flymake "1.2.1")) ;; SPDX-License-Identifier: MIT -;; Version: 1.0.0 +;; Version: 2.0.0 ;; Copyright (c) 2021 Mohsin Kaleem ;; @@ -32,36 +32,36 @@ ;;; Commentary: -;; flymake-rest is a helper for migrating from flycheck to flymake. +;; flymake-collection is a helper for migrating from flycheck to flymake. ;; ;; This includes the definition of several diagnostic functions, hooks ;; to specify the precedence and preferred order of them and the means ;; to easily configure flymake linting. ;; -;; For more see [[file:README.org][README.org]] or https://github.com/mohkale/flymake-rest. +;; For more see [[file:README.org][README.org]] or https://github.com/mohkale/flymake-collection. ;;; Code: -(defgroup flymake-rest nil +(defgroup flymake-collection nil "Flymake flycheck compatibility." - :prefix "flymake-rest" + :prefix "flymake-collection" :group 'flymake) -(defgroup flymake-rest-faces nil - "Faces used by flymake-rest." - :group 'flymake-rest +(defgroup flymake-collection-faces nil + "Faces used by flymake-collection." + :group 'flymake-collection :group 'faces) -(defface flymake-rest-checker +(defface flymake-collection-checker '((t (:inherit (dired-directory bold)))) "Title of a checker as shown in the diagnostic message.") -(defface flymake-rest-diag-id +(defface flymake-collection-diag-id '((t (:inherit font-lock-type-face))) "Id of a diagnostic.") -(defun flymake-rest-parse-json (output) - "Helper for `flymake-rest-define' to parse JSON OUTPUT. +(defun flymake-collection-parse-json (output) + "Helper for `flymake-collection-define' to parse JSON OUTPUT. Adapted from `flycheck-parse-json'. This reads a bunch of JSON-Lines like output from OUTPUT into a list and then returns it." @@ -81,6 +81,10 @@ like output from OUTPUT into a list and then returns it." (forward-line))) objects)) -(provide 'flymake-rest) +(define-obsolete-face-alias 'flymake-rest-checker 'flymake-collection-checker "2.0.0") +(define-obsolete-face-alias 'flymake-rest-diag-id 'flymake-collection-diag-id "2.0.0") +(define-obsolete-function-alias 'flymake-rest-parse-json 'flymake-collection-parse-json "2.0.0") -;;; flymake-rest.el ends here +(provide 'flymake-collection) + +;;; flymake-collection.el ends here