diff --git a/CHANGELOG.md b/CHANGELOG.md index 9709e995..e17944a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how * Add support for `elisp-lint` (#79) * Adapt `-a`/`--all` option for archives command (#83) * Merge command `list-all` to list with `-a`/`--all` option (#84) +* Support JSON format with Eask-file linter (#85) ## 0.7.x > Released Sep 08, 2022 diff --git a/cmds/checker/check-eask.js b/cmds/checker/check-eask.js index d1860c5a..7fabafd9 100644 --- a/cmds/checker/check-eask.js +++ b/cmds/checker/check-eask.js @@ -21,7 +21,20 @@ exports.command = ['check-eask [files..]']; exports.desc = 'run eask checker'; +exports.builder = { + files: { + description: 'specify Eask-files for checker to lint', + requiresArg: false, + type: 'array', + }, + json: { + description: 'Output lint result in JSON format', + type: 'boolean', + }, +}; exports.handler = async (argv) => { - await UTIL.e_call(argv, 'checker/check-eask'); + await UTIL.e_call(argv, 'checker/check-eask' + , argv.files + , UTIL.def_flag(argv.json, '--json', argv.json)); }; diff --git a/docs/content/en/Getting Started/Commands and options.md b/docs/content/en/Getting Started/Commands and options.md index dd34c8db..07d52ea4 100644 --- a/docs/content/en/Getting Started/Commands and options.md +++ b/docs/content/en/Getting Started/Commands and options.md @@ -30,8 +30,13 @@ Eask will generate file like: "VERSION" "YOUR PACKAGE SUMMARY") +(website-url "https://example.com/project-url/") +(keywords "KEYWORD1" "KEYWORD2") + (package-file "PACKAGE-FILE") +(script "test" "echo \"Error: no test specified\" && exit 1") + (source "gnu") (depends-on "emacs" "26.1") @@ -484,7 +489,7 @@ $ eask [GLOBAL-OPTIONS] upgrade-eask ``` {{< hint warning >}} -💡 This will only work if you install it from source! +💡 This will only work if you install it from the source! {{< /hint >}} ## 🔍 eask locate @@ -504,7 +509,18 @@ Commands to check your Eask-file. Lint an `Eask`-file. ```sh -$ eask [GLOBAL-OPTIONS] check-eask +$ eask [GLOBAL-OPTIONS] check-eask [FILES..] +``` + +```bash +# lint all Eask-files in the current directory and subdirectories +eask check-eask +# lint specific files +eask check-eask Eask Eask.27 +# lint all Eask-files in specified directory and subdirectories +eask check-eask src/ +# print result as JSON +eask check-eask --json ``` # 🚩 Global Options diff --git a/lisp/_prepare.el b/lisp/_prepare.el index 4083b27d..beb56c8c 100644 --- a/lisp/_prepare.el +++ b/lisp/_prepare.el @@ -5,6 +5,7 @@ (require 'ansi-color) (require 'package) (require 'project) +(require 'json) (require 'nsm) (require 'url-vars) @@ -433,6 +434,7 @@ the `eask-start' execution.") (defun eask-allow-error-p () (eask--flag "--allow-error")) ; --allow-error (defun eask-insecure-p () (eask--flag "--insecure")) ; --insecure (defun eask-no-color-p () (eask--flag "--no-color")) ; --no-color +(defun eask-json-p () (eask--flag "--json")) ; --json ;;; String (with arguments) (defun eask-proxy () (eask--flag-value "--proxy")) ; --proxy @@ -502,7 +504,8 @@ other scripts internally. See function `eask-call'.") (eask--form-options '("--proxy" "--http-proxy" "--https-proxy" "--no-proxy" "--verbose" "--silent" - "--depth" "--dest")) + "--depth" "--dest" + "--json")) "List of arguments (number/string) type options.") (defconst eask--command-list @@ -594,7 +597,7 @@ Eask file in the workspace." (defun eask-file-load (location &optional noerror) "Load Eask file in the LOCATION." (when-let* ((target-eask-file (expand-file-name location user-emacs-directory)) - (result (eask--alias-env (load target-eask-file noerror t)))) + (result (eask--alias-env (load target-eask-file 'noerror t)))) (setq eask-file target-eask-file ; assign eask file only if success eask-file-root (file-name-directory target-eask-file)) (run-hooks 'eask-file-loaded-hook) @@ -642,22 +645,25 @@ Eask file in the workspace." (eask--print-env-info) (cond ((eask-global-p) - ;; We accept Eask file in global scope, but it shouldn't be used - ;; as a sandbox. - (if (eask-file-try-load "./") - (eask-msg "✓ Loading config Eask file in %s... done!" eask-file) - (eask-msg "✗ Loading config Eask file... missing!")) - (message "") - (package-activate-all) - (eask-with-progress - (ansi-green "Loading your configuration... ") - (eask-with-verbosity 'debug - (unless (eask-quick-p) - (load (locate-user-emacs-file "early-init.el") t) - (load (locate-user-emacs-file "../.emacs") t) - (load (locate-user-emacs-file "init.el") t))) - (ansi-green (if (eask-quick-p) "skipped ✗" "done ✓"))) - (eask--with-hooks ,@body)) + (let* ((special (eask-special-p)) + (inhibit-config (or special (eask-quick-p)))) + (unless special + ;; We accept Eask-file in global scope, but it shouldn't be used + ;; for the sandbox. + (if (eask-file-try-load "./") + (eask-msg "✓ Loading config Eask file in %s... done!" eask-file) + (eask-msg "✗ Loading config Eask file... missing!"))) + (message "") + (package-activate-all) + (eask-with-progress + (ansi-green "Loading your configuration... ") + (eask-with-verbosity 'debug + (unless inhibit-config + (load (locate-user-emacs-file "early-init.el") t) + (load (locate-user-emacs-file "../.emacs") t) + (load (locate-user-emacs-file "init.el") t))) + (ansi-green (if inhibit-config "skipped ✗" "done ✓"))) + (eask--with-hooks ,@body))) (t (let* ((user-emacs-directory (expand-file-name (concat ".eask/" emacs-version "/"))) (package-user-dir (expand-file-name "elpa" user-emacs-directory)) @@ -665,12 +671,12 @@ Eask file in the workspace." (user-init-file (locate-user-emacs-file "init.el")) (custom-file (locate-user-emacs-file "custom.el")) (special (eask-special-p))) - (if (or (eask-file-try-load "../../") - special) + (unless special + (if (eask-file-try-load "../../") + (eask-msg "✓ Loading Eask file in %s... done!" eask-file) + (eask-msg "✗ Loading Eask file... missing!"))) + (if (or special eask-file) (progn - (if eask-file - (eask-msg "✓ Loading Eask file in %s... done!" eask-file) - (eask-msg "✗ Loading Eask file... missing!")) (message "") (package-activate-all) (unless special diff --git a/lisp/checker/check-eask.el b/lisp/checker/check-eask.el index 59c0b5db..d388ad2e 100644 --- a/lisp/checker/check-eask.el +++ b/lisp/checker/check-eask.el @@ -4,7 +4,13 @@ ;; ;; Commmand use to run Eask checker ;; -;; $ eask check-eask +;; $ eask check-eask [FILES..] +;; +;; +;; Initialization options: +;; +;; [files..] specify Eask-files for checker to lint +;; --json Output lint result in JSON format ;; ;;; Code: @@ -14,34 +20,123 @@ (file-name-directory (nth 1 (member "-scriptload" command-line-args)))) nil t) +;; Plain Text (defvar eask--checker-log nil) +;; JSON format +(defvar eask--checker-warnings nil) +(defvar eask--checker-errors nil) + +(defun eask--pretty-json (json) + "Return pretty JSON." + (with-temp-buffer (insert json) (json-pretty-print-buffer) (buffer-string))) + +(defun eask--column-at-point (point) + "Get column at POINT." + (save-excursion (goto-char point) (current-column))) (defun eask--load-buffer () - "Return the current loading file session." + "Return the current file loading session." (car (cl-remove-if-not (lambda (elm) (string-prefix-p " *load*-" (buffer-name elm))) (buffer-list)))) +(defun eask--write-json-format (level msg) + "Prepare log for JSON format." + (let* ((thing (thing-at-point 'sexp)) + (bounds (bounds-of-thing-at-point 'sexp)) + (filename (or load-file-name eask-file)) + (start (car bounds)) + (end (cdr bounds)) + (start-line (if load-file-name (line-number-at-pos start) 0)) + (start-col (if load-file-name (eask--column-at-point start) 0)) + (start-pos (if load-file-name start 0)) + (end-line (if load-file-name (line-number-at-pos end) 0)) + (end-col (if load-file-name (eask--column-at-point end) 0)) + (end-pos (if load-file-name end 0)) + (msg (ansi-color-filter-apply msg))) + (push `((range . ((start . ((line . ,start-line) + (col . ,start-col) + (pos . ,start-pos))) + (end . ((line . ,end-line) + (col . ,end-col) + (pos . ,end-pos))))) + (filename . ,filename) + (message . ,msg)) + (cl-case level + (`error eask--checker-errors) + (`warn eask--checker-warnings))))) + +(defun eask--write-plain-text (level msg) + "Prepare log for plain text format." + (let* ((level-string (cl-case level + (`error "Error") + (`warn "Warning"))) + (log (format "%s:%s:%s %s: %s" + (or load-file-name eask-file) + (if load-file-name (line-number-at-pos) 0) + (if load-file-name (current-column) 0) + level-string + msg))) + (push (ansi-color-filter-apply log) eask--checker-log))) + (defun eask--write-log (level msg) "Write the log." (unless (string= " *temp*" (buffer-name)) ; avoid error from `package-file' directive (with-current-buffer (or (eask--load-buffer) (buffer-name)) - (let* ((level-string (cl-case level - (`error "Error") - (`warn "Warning"))) - (log (format "%s:%s:%s %s: %s" - (file-name-nondirectory (or load-file-name eask-file)) - (if load-file-name (line-number-at-pos) 0) - (if load-file-name (current-column) 0) - level-string - msg))) - (push (ansi-color-filter-apply log) eask--checker-log))))) + (funcall + (cond ((eask-json-p) #'eask--write-json-format) + (t #'eask--write-plain-text)) + level msg)))) + +(defmacro eask--save-eask-file-state (&rest body) + "Execute BODY without touching the Eask-file global variables." + (declare (indent 0) (debug t)) + `(let (package-archives + package-archive-priorities + eask-package + eask-package-desc + eask-website-url + eask-keywords + eask-package-file + eask-files + eask-scripts + eask-depends-on-emacs + eask-depends-on + eask-depends-on-dev) + ,@body)) +;; +;;; Program Entry + +;; Preparation (add-hook 'eask-on-error-hook #'eask--write-log) (add-hook 'eask-on-warning-hook #'eask--write-log) -(eask-start - (if eask--checker-log - (mapc #'eask-msg (reverse eask--checker-log)) - (eask-msg "(No issues found)"))) +(let* ((default-directory (if (eask-global-p) user-emacs-directory + default-directory)) + (files (or (eask-expand-file-specs (eask-args)) + (eask-expand-file-specs '("Eask*" "**/Eask*")))) + checked-files) + ;; Linting + (dolist (file files) + (eask--save-eask-file-state + (eask--setup-env + (eask--alias-env + (when (ignore-errors (load file 'noerror t)) + (push file checked-files)))))) + + ;; Print result + (eask-msg "") + (cond ((and (eask-json-p) ; JSON format + (or eask--checker-warnings eask--checker-errors)) + (eask-msg + (eask--pretty-json (json-encode + `((warnings . ,eask--checker-warnings) + (errors . ,eask--checker-errors)))))) + (eask--checker-log ; Plain text + (mapc #'eask-msg (reverse eask--checker-log))) + (t + (eask-info "(Checked %s file%s)" + (length checked-files) + (eask--sinr checked-files "" "s"))))) ;;; checker/check-eask.el ends here diff --git a/lisp/clean/dist.el b/lisp/clean/dist.el index 953644aa..980fed02 100644 --- a/lisp/clean/dist.el +++ b/lisp/clean/dist.el @@ -48,6 +48,7 @@ (eask-dist-path (expand-file-name eask-dist-path))) (if (file-directory-p eask-dist-path) (eask--clean-dist eask-dist-path) - (eask-info "Target dist path is missing: %s" eask-dist-path)))) + (eask-msg "") + (eask-info "(No dist folder needs to be cleaned)" eask-dist-path)))) ;;; clean/dist.el ends here diff --git a/lisp/clean/elc.el b/lisp/clean/elc.el index 7f11f8b7..da29dafb 100644 --- a/lisp/clean/elc.el +++ b/lisp/clean/elc.el @@ -20,6 +20,7 @@ (mapc #'eask-delete-file files) (eask-info "✓ (Total of %s .elc file%s deleted)" (length files) (eask--sinr files "" "s"))) + (eask-msg "") (eask-info "(No .elc file found in workspace)"))) ;;; clean/elc.el ends here diff --git a/lisp/clean/workspace.el b/lisp/clean/workspace.el index 78c27368..1b2f8ceb 100644 --- a/lisp/clean/workspace.el +++ b/lisp/clean/workspace.el @@ -20,7 +20,7 @@ (file-name-directory (directory-file-name user-emacs-directory))))) (ignore-errors (delete-directory target-dir t)) (if eask--first-init-p - (eask-info "(Workspace already cleaned)") - (eask-info "✓ Done (workspace `%s` is cleaned)" target-dir)))) + (eask-info "(Workspace is already cleaned)") + (eask-info "✓ (Workspace is now cleaned)" target-dir)))) ;;; clean/workspace.el ends here diff --git a/lisp/core/compile.el b/lisp/core/compile.el index 4f31cd4e..33933141 100644 --- a/lisp/core/compile.el +++ b/lisp/core/compile.el @@ -56,6 +56,7 @@ (let* ((compiled (cl-remove-if-not #'eask--byte-compile-file files)) (compiled (length compiled)) (skipped (- (length files) compiled))) + (eask-msg "") (eask-info "(Total of %s file%s compiled, %s skipped)" compiled (eask--sinr compiled "" "s") skipped))) diff --git a/lisp/core/concat.el b/lisp/core/concat.el index 87fee8f4..37b3d899 100644 --- a/lisp/core/concat.el +++ b/lisp/core/concat.el @@ -41,6 +41,7 @@ (with-temp-buffer (eask-progress-seq " - Visiting" files "appended! ✓" #'insert-file-contents) (write-region (buffer-string) nil target-filename) + (eask-msg "") (eask-info "Done. (Wrote file in %s)" target-filename))))) ;;; core/concat.el ends here diff --git a/lisp/core/exec-path.el b/lisp/core/exec-path.el index 6479c42a..d4354117 100644 --- a/lisp/core/exec-path.el +++ b/lisp/core/exec-path.el @@ -21,6 +21,7 @@ (eask-start (eask-pkg-init) (mapc #'eask--print-exec-path exec-path) + (eask-msg "") (eask-info "(Total of %s exec-path)" (length exec-path))) ;;; core/exec-path.el ends here diff --git a/lisp/core/files.el b/lisp/core/files.el index 02ccfbfb..2cf1c2da 100644 --- a/lisp/core/files.el +++ b/lisp/core/files.el @@ -21,6 +21,7 @@ (eask-start (let ((files (eask-package-files))) (mapc #'eask--print-filename files) + (eask-msg "") (eask-info "(Total of %s item%s listed)" (length files) (eask--sinr files "" "s")))) ;;; core/files.el ends here diff --git a/lisp/core/install.el b/lisp/core/install.el index f54bc563..347e5f38 100644 --- a/lisp/core/install.el +++ b/lisp/core/install.el @@ -31,6 +31,7 @@ (installed (length pkg-not-installed)) (skipped (- len installed))) (eask-log "Installing %s specified package%s..." len s) (mapc #'eask-package-install names) + (eask-msg "") (eask-info "(Total of %s package%s installed, %s skipped)" installed s skipped))) @@ -52,6 +53,7 @@ (progn (add-to-list 'load-path (expand-file-name (eask-packaged-name) package-user-dir)) (package-install-file target) + (eask-msg "") (eask-info "(Installed in %s)" (file-name-directory (locate-library name)))) (eask-info "✗ (No files have been intalled)") diff --git a/lisp/core/load-path.el b/lisp/core/load-path.el index 5df4f72e..0b155c64 100644 --- a/lisp/core/load-path.el +++ b/lisp/core/load-path.el @@ -21,6 +21,7 @@ (eask-start (eask-pkg-init) (mapc #'eask--print-load-path load-path) + (eask-msg "") (eask-info "(Total of %s load-path)" (length load-path))) ;;; core/load-path.el ends here diff --git a/lisp/core/outdated.el b/lisp/core/outdated.el index f1c98d8e..60c55413 100644 --- a/lisp/core/outdated.el +++ b/lisp/core/outdated.el @@ -26,9 +26,11 @@ ;; Remove current developing packages (setq pkg-list (remove (intern (eask-guess-package-name)) pkg-list))) (eask--list pkg-list package-alist 0) + (eask-msg "") (eask-info "(Total of %s dependenc%s %s outdated)" (length pkg-list) (eask--sinr pkg-list "y" "ies") (eask--sinr pkg-list "is" "are"))) + (eask-msg "") (eask-info "(No outdated dependencies)"))) ;;; core/outdated.el ends here diff --git a/lisp/core/package.el b/lisp/core/package.el index 62ab2c7a..39c7bb7b 100644 --- a/lisp/core/package.el +++ b/lisp/core/package.el @@ -72,6 +72,7 @@ (rcp (eask-package-dir-recipe version)) (package-build-working-dir default-directory) (package-build-archive-dir eask-dist-path)) + (eask-msg "") (eask-with-progress (format "Building artifact %s (%s)... " (eask-package-name) version) (package-build--package rcp) @@ -85,6 +86,7 @@ (set-buffer-file-coding-system 'utf-8-unix) (save-buffer))) + (eask-msg "") (eask-info "(Built in %s)" packaged))) ;;; core/package.el ends here diff --git a/lisp/core/pkg-file.el b/lisp/core/pkg-file.el index bc3dfd2a..fd151cb4 100644 --- a/lisp/core/pkg-file.el +++ b/lisp/core/pkg-file.el @@ -43,6 +43,14 @@ (eask-start (if eask-package-desc (eask--generate-from-pkg-desc) (eask--generate-from-eask-file)) - (eask-info "(Generated pkg-file -> %s)" eask--pkg-filename)) + (eask-info "%s:" (file-name-nondirectory (directory-file-name eask--pkg-filename))) + (eask-msg "") + (eask-msg "%s" (with-temp-buffer + (emacs-lisp-mode) + (insert-file-contents eask--pkg-filename) + (pp-buffer) + (eask--silent (indent-region (point-min) (point-max))) + (buffer-string))) + (eask-info "(Generated -pkg.el file in %s)" eask--pkg-filename)) ;;; core/pkg-file.el ends here diff --git a/lisp/core/recipe.el b/lisp/core/recipe.el index 2ee5e44d..0481c771 100644 --- a/lisp/core/recipe.el +++ b/lisp/core/recipe.el @@ -34,6 +34,7 @@ (eask-msg "") (eask-msg "Recipe: %s" (pp-to-string recipe)) (eask-msg "")) + (eask-msg "") (eask-info "(Repository URL is required to form a recipe)") (eask-help "core/recipe"))) diff --git a/lisp/core/refresh.el b/lisp/core/refresh.el index 92598443..a24a1074 100644 --- a/lisp/core/refresh.el +++ b/lisp/core/refresh.el @@ -15,6 +15,8 @@ nil t) (eask-start - (eask-pkg-init)) + (eask-pkg-init) + (eask-msg "") + (eask-info "(Done)")) ;;; core/refresh.el ends here diff --git a/lisp/core/reinstall.el b/lisp/core/reinstall.el index 04808e2a..d8764595 100644 --- a/lisp/core/reinstall.el +++ b/lisp/core/reinstall.el @@ -41,7 +41,9 @@ ((package-installed-p name))) (progn (eask-package-reinstall name) + (eask-msg "") (eask-info "(Reinstalled %s)" name)) + (eask-msg "") (eask-info "✗ (No packages have been reintalled)") (eask-help "core/reinstall")))) diff --git a/lisp/core/search.el b/lisp/core/search.el index d44cae0e..98b42ba5 100644 --- a/lisp/core/search.el +++ b/lisp/core/search.el @@ -37,8 +37,10 @@ (setq result (append result (eask--search-packages query)))) (delete-dups result) (eask--list result package-archive-contents) + (eask-msg "") (eask-info "(Search result of %s package%s)" (length result) (eask--sinr result "" "s"))) + (eask-msg "") (eask-info "(No search operation; missing queries specification)") (eask-help "core/search"))) diff --git a/lisp/core/uninstall.el b/lisp/core/uninstall.el index 92626cbe..b224c667 100644 --- a/lisp/core/uninstall.el +++ b/lisp/core/uninstall.el @@ -28,6 +28,7 @@ (deleted (length pkg-installed)) (skipped (- len deleted))) (eask-log "Uninstalling %s specified package%s..." len s) (mapc #'eask-package-delete names) + (eask-msg "") (eask-info "(Total of %s package%s deleted, %s skipped)" deleted s skipped))) @@ -39,6 +40,7 @@ ((package-installed-p name))) (progn (eask-package-delete name) + (eask-msg "") (eask-info "(Deleted %s)" name)) (eask-info "✗ (No packages have been unintalled)") (eask-help "core/uninstall")))) diff --git a/lisp/core/upgrade.el b/lisp/core/upgrade.el index 7565774a..87b53389 100644 --- a/lisp/core/upgrade.el +++ b/lisp/core/upgrade.el @@ -61,7 +61,9 @@ (if-let ((upgrades (eask-package--upgrades))) (progn (mapcar #'eask-package-upgrade upgrades) + (eask-msg "") (eask-info "(Done upgrading all packages)")) + (eask-msg "") (eask-info "(All packages are up to date)"))) (eask-start diff --git a/lisp/lint/checkdoc.el b/lisp/lint/checkdoc.el index e379fe96..61030cdb 100644 --- a/lisp/lint/checkdoc.el +++ b/lisp/lint/checkdoc.el @@ -45,13 +45,14 @@ (eask-start (require 'checkdoc) - (if-let* ((files (eask-args-or-package-el-files)) - (len (length files)) - (s (eask--sinr len "" "s")) - (have (eask--sinr len "has" "have"))) + (if-let ((files (eask-args-or-package-el-files))) (progn (mapcar #'eask--checkdoc-file files) - (eask-info "(Total of %s file%s %s checked)" len s have)) + (eask-msg "") + (eask-info "(Total of %s file%s %s checked)" (length files) + (eask--sinr files "" "s") + (eask--sinr files "has" "have"))) + (eask-msg "") (eask-info "(No files have been checked (checkdoc))") (if (eask-args) (eask--print-no-matching-files) diff --git a/lisp/lint/declare.el b/lisp/lint/declare.el index faeaa00c..8d2e6e49 100644 --- a/lisp/lint/declare.el +++ b/lisp/lint/declare.el @@ -34,13 +34,14 @@ (eask-start (require 'check-declare) - (if-let* ((files (eask-args-or-package-el-files)) - (len (length files)) - (s (eask--sinr len "" "s")) - (have (eask--sinr len "has" "have"))) + (if-let ((files (eask-args-or-package-el-files))) (progn (mapcar #'eask--check-declare-file files) - (eask-info "(Total of %s file%s %s checked)" len s have)) + (eask-msg "") + (eask-info "(Total of %s file%s %s checked)" (length files) + (eask--sinr files "" "s") + (eask--sinr files "has" "have"))) + (eask-msg "") (eask-info "(No files have been checked (declare))") (if (eask-args) (eask--print-no-matching-files) diff --git a/lisp/lint/elint.el b/lisp/lint/elint.el index b93f35f3..51ebd834 100644 --- a/lisp/lint/elint.el +++ b/lisp/lint/elint.el @@ -32,13 +32,14 @@ (eask-start (require 'elint) - (if-let* ((files (eask-args-or-package-el-files)) - (len (length files)) - (s (eask--sinr len "" "s")) - (have (eask--sinr len "has" "have"))) + (if-let ((files (eask-args-or-package-el-files))) (progn (mapcar #'eask--elint-file files) - (eask-info "(Total of %s file%s %s checked)" len s have)) + (eask-msg "") + (eask-info "(Total of %s file%s %s checked)" (length files) + (eask--sinr files "" "s") + (eask--sinr files "has" "have"))) + (eask-msg "") (eask-info "(No files have been checked (elint))") (if (eask-args) (eask--print-no-matching-files) diff --git a/lisp/lint/elisp-lint.el b/lisp/lint/elisp-lint.el index e682f785..4c09b797 100644 --- a/lisp/lint/elisp-lint.el +++ b/lisp/lint/elisp-lint.el @@ -45,7 +45,10 @@ (if-let ((files (eask-args-or-package-el-files))) (progn (mapcar #'eask--elisp-lint-process-file files) - (eask-info "(Total of %s files linted)" (length files))) + (eask-msg "") + (eask-info "(Total of %s file%s linted)" (length files) + (eask--sinr files "" "s"))) + (eask-msg "") (eask-info "(No files have been linted)") (if (eask-args) (eask--print-no-matching-files) diff --git a/lisp/lint/elsa.el b/lisp/lint/elsa.el index 57d7f589..8053cd81 100644 --- a/lisp/lint/elsa.el +++ b/lisp/lint/elsa.el @@ -47,7 +47,10 @@ (if-let ((files (eask-args-or-package-el-files))) (progn (mapcar #'eask--elsa-process-file files) - (eask-info "(Total of %s files linted)" (length files))) + (eask-msg "") + (eask-info "(Total of %s file%s linted)" (length files) + (eask--sinr files "" "s"))) + (eask-msg "") (eask-info "(No files have been linted)") (if (eask-args) (eask--print-no-matching-files) diff --git a/lisp/lint/indent.el b/lisp/lint/indent.el index 3ebec9e8..5eff712f 100644 --- a/lisp/lint/indent.el +++ b/lisp/lint/indent.el @@ -46,7 +46,10 @@ (eask-package-el-files)))) (progn (mapcar #'eask--indent-lint-file files) - (eask-info "(Total of %s files linted)" (length files))) + (eask-msg "") + (eask-info "(Total of %s file%s linted)" (length files) + (eask--sinr files "" "s"))) + (eask-msg "") (eask-info "(No files have been linted)") (if (eask-args) (eask--print-no-matching-files) diff --git a/lisp/lint/package.el b/lisp/lint/package.el index f0755695..a58d9275 100644 --- a/lisp/lint/package.el +++ b/lisp/lint/package.el @@ -48,7 +48,10 @@ (eask-pkg-init) (setq package-lint-main-file eask-package-file) (mapcar #'eask--package-lint-file files) - (eask-info "(Total of %s files linted)" (length files))) + (eask-msg "") + (eask-info "(Total of %s file%s linted)" (length files) + (eask--sinr files "" "s"))) + (eask-msg "") (eask-info "(No files have been linted)") (if (eask-args) (eask--print-no-matching-files) diff --git a/lisp/lint/regexps.el b/lisp/lint/regexps.el index 64528cef..52eac80d 100644 --- a/lisp/lint/regexps.el +++ b/lisp/lint/regexps.el @@ -52,7 +52,10 @@ (progn (setq package-lint-main-file eask-package-file) (mapcar #'eask--relint-file files) - (eask-info "(Total of %s files linted)" (length files))) + (eask-msg "") + (eask-info "(Total of %s file%s linted)" (length files) + (eask--sinr files "" "s"))) + (eask-msg "") (eask-info "(No files have been linted)") (if (eask-args) (eask--print-no-matching-files) diff --git a/src/util.js b/src/util.js index 8142fc81..60c2106f 100644 --- a/src/util.js +++ b/src/util.js @@ -83,18 +83,19 @@ function _global_options(argv) { flags.push(def_flag(argv.debug, '--debug')); flags.push(def_flag(argv.strict, '--strict')); flags.push(def_flag(argv['allow-error'], '--allow-error')); + flags.push(def_flag(argv.insecure, '--insecure', argv.insecure)); flags.push(def_flag(argv.timestamps, (argv.timestamps) ? '--timestamps' : '--no-timestamps')); flags.push(def_flag(argv['log-level'], (argv['log-level']) ? '--log-level' : '--no-log-level')); flags.push(def_flag(argv['log-file'], (argv['log-file']) ? '--log-file' : '--no-log-file')); flags.push(def_flag(argv['elapsed-time'], (argv['elapsed-time']) ? '--elapsed-time' : '--no-elapsed-time')); flags.push(def_flag(argv['color'], '--no-color')); - /* With arguments */ + /* Number type */ + flags.push(def_flag(argv.verbose, '--verbose', argv.verbose)); + /* String type */ flags.push(def_flag(argv.proxy, '--proxy', argv.proxy)); flags.push(def_flag(argv['http-proxy'], '--http-proxy', argv['http-proxy'])); flags.push(def_flag(argv['https-proxy'], '--https-proxy', argv['https-proxy'])); flags.push(def_flag(argv['no-proxy'], '--no-proxy', argv['no-proxy'])); - flags.push(def_flag(argv.insecure, '--insecure', argv.insecure)); - flags.push(def_flag(argv.verbose, '--verbose', argv.verbose)); return flags; } diff --git a/test/checker/dsl/run.sh b/test/checker/dsl/run.sh index 9e56cc9f..e48bdd53 100644 --- a/test/checker/dsl/run.sh +++ b/test/checker/dsl/run.sh @@ -27,5 +27,10 @@ set -e # Naviate to the test package cd $(dirname "$0") -echo "Testing check-eask command..." +echo "Testing check-eask command... (Plain text)" eask check-eask +eask check-eask Eask + +echo "Testing check-eask command... (JSON format)" +eask check-eask --json +eask check-eask Eask --json diff --git a/test/checker/metadata/run.sh b/test/checker/metadata/run.sh index 9e56cc9f..e48bdd53 100644 --- a/test/checker/metadata/run.sh +++ b/test/checker/metadata/run.sh @@ -27,5 +27,10 @@ set -e # Naviate to the test package cd $(dirname "$0") -echo "Testing check-eask command..." +echo "Testing check-eask command... (Plain text)" eask check-eask +eask check-eask Eask + +echo "Testing check-eask command... (JSON format)" +eask check-eask --json +eask check-eask Eask --json