From 4367f682d9c2a124f9627904ac248884a7ae05d7 Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 23 Feb 2024 00:37:34 -0800 Subject: [PATCH 1/3] feat: Rename command check-eask to analyze --- .../check-eask.js => core/analyze.js} | 4 +- .../Commands-and-options/_index.en.md | 14 ++--- .../Commands-and-options/_index.zh-tw.md | 14 ++--- eask | 1 - .../check-eask.el => core/analyze.el} | 60 +++++++++---------- .../help/{checker/check-eask => core/analyze} | 2 +- 6 files changed, 47 insertions(+), 48 deletions(-) rename cmds/{checker/check-eask.js => core/analyze.js} (93%) rename lisp/{checker/check-eask.el => core/analyze.el} (73%) rename lisp/help/{checker/check-eask => core/analyze} (66%) diff --git a/cmds/checker/check-eask.js b/cmds/core/analyze.js similarity index 93% rename from cmds/checker/check-eask.js rename to cmds/core/analyze.js index 2bdbc1f9..af3f0c70 100644 --- a/cmds/checker/check-eask.js +++ b/cmds/core/analyze.js @@ -17,7 +17,7 @@ "use strict"; -exports.command = ['check-eask [files..]']; +exports.command = ['analyze [files..]']; exports.desc = 'Run Eask checker'; exports.builder = yargs => yargs .positional( @@ -40,7 +40,7 @@ exports.builder = yargs => yargs }); exports.handler = async (argv) => { - await UTIL.e_call(argv, 'checker/check-eask' + await UTIL.e_call(argv, 'core/analyze' , argv.files , UTIL.def_flag(argv.json, '--json') , UTIL.def_flag(argv.output, '--output', argv.output)); diff --git a/docs/content/Getting-Started/Commands-and-options/_index.en.md b/docs/content/Getting-Started/Commands-and-options/_index.en.md index 8f716ab0..66cff800 100644 --- a/docs/content/Getting-Started/Commands-and-options/_index.en.md +++ b/docs/content/Getting-Started/Commands-and-options/_index.en.md @@ -867,28 +867,28 @@ $ eask [GLOBAL-OPTIONS] locate Commands to check your Eask-file. -## πŸ” eask check-eask +## πŸ” eask analyze Lint an `Eask`-file. ```sh -$ eask [GLOBAL-OPTIONS] check-eask [FILES..] +$ eask [GLOBAL-OPTIONS] analyze [FILES..] ``` Example: ```bash # lint all Eask-files in the current directory and subdirectories -eask check-eask +eask analyze # lint specific files -eask check-eask Eask Eask.27 +eask analyze Eask Eask.27 # lint all Eask-files in specified directory and subdirectories -eask check-eask src/ +eask analyze src/ # print result as JSON -eask check-eask --json +eask analyze --json ``` -For more detail, run `eask check-eask --help`. +For more detail, run `eask analyze --help`. # 🚩 Global Options diff --git a/docs/content/Getting-Started/Commands-and-options/_index.zh-tw.md b/docs/content/Getting-Started/Commands-and-options/_index.zh-tw.md index 6efbdcd5..4c79855e 100644 --- a/docs/content/Getting-Started/Commands-and-options/_index.zh-tw.md +++ b/docs/content/Getting-Started/Commands-and-options/_index.zh-tw.md @@ -854,28 +854,28 @@ $ eask [GLOBAL-OPTIONS] locate ζͺ’ζŸ₯ζ‚¨ηš„ Eask ζ–‡δ»Άηš„ε‘½δ»€γ€‚ -## πŸ” eask check-eask +## πŸ” eask analyze ζͺ’ζŸ₯ `Eask` 文仢。 ```sh -$ eask [GLOBAL-OPTIONS] check-eask [FILES..] +$ eask [GLOBAL-OPTIONS] analyze [FILES..] ``` 例子: ```bash # lint all Eask-files in the current directory and subdirectories -eask check-eask +eask analyze # lint specific files -eask check-eask Eask Eask.27 +eask analyze Eask Eask.27 # lint all Eask-files in specified directory and subdirectories -eask check-eask src/ +eask analyze src/ # print result as JSON -eask check-eask --json +eask analyze --json ``` -ζœ‰ι—œζ›΄ε€šθ©³η΄°δΏ‘ζ―οΌŒθ«‹ι‹θ‘Œ `eask check-eask --help`。 +ζœ‰ι—œζ›΄ε€šθ©³η΄°δΏ‘ζ―οΌŒθ«‹ι‹θ‘Œ `eask analyze --help`。 # 🚩 ε…¨εŸŸιΈι … diff --git a/eask b/eask index 13394eb8..65493387 100644 --- a/eask +++ b/eask @@ -18,7 +18,6 @@ yargs .scriptName('') .epilogue(epilogue) .commandDir('cmds/core/') - .commandDir('cmds/checker/') .commandDir('cmds/util/') .command({ command: '*', diff --git a/lisp/checker/check-eask.el b/lisp/core/analyze.el similarity index 73% rename from lisp/checker/check-eask.el rename to lisp/core/analyze.el index f8418c84..3dfa9512 100644 --- a/lisp/checker/check-eask.el +++ b/lisp/core/analyze.el @@ -1,10 +1,10 @@ -;;; checker/check-eask.el --- Run eask checker -*- lexical-binding: t; -*- +;;; core/analyze.el --- Run eask checker -*- lexical-binding: t; -*- ;;; Commentary: ;; ;; Commmand use to run Eask checker ;; -;; $ eask check-eask [FILES..] +;; $ eask analyze [FILES..] ;; ;; ;; Positionals: @@ -24,24 +24,24 @@ nil t)) ;; Plain Text -(defvar eask-checker--log nil) +(defvar eask-analyze--log nil) ;; JSON format -(defvar eask-checker--warnings nil) -(defvar eask-checker--errors nil) +(defvar eask-analyze--warnings nil) +(defvar eask-analyze--errors nil) -(defun eask-checker--pretty-json (json) +(defun eask-analyze--pretty-json (json) "Return pretty JSON." (with-temp-buffer (insert json) (json-pretty-print-buffer) (buffer-string))) -(defun eask-checker--load-buffer () +(defun eask-analyze--load-buffer () "Return the current file loading session." (car (cl-remove-if-not (lambda (elm) (string-prefix-p " *load*-" (buffer-name elm))) (buffer-list)))) -(defun eask-checker--write-json-format (level msg) +(defun eask-analyze--write-json-format (level msg) "Prepare log for JSON format. -For arguments LEVEL and MSG, please see function `eask-checker--write-log' for more +For arguments LEVEL and MSG, please see function `eask-analyze--write-log' for more information." (let* ((bounds (bounds-of-thing-at-point 'sexp)) (filename (or load-file-name eask-file)) @@ -63,13 +63,13 @@ information." (filename . ,filename) (message . ,msg)) (cl-case level - (`error eask-checker--errors) - (`warn eask-checker--warnings))))) + (`error eask-analyze--errors) + (`warn eask-analyze--warnings))))) -(defun eask-checker--write-plain-text (level msg) +(defun eask-analyze--write-plain-text (level msg) "Prepare log for plain text format. -For arguments LEVEL and MSG, please see function `eask-checker--write-log' for more +For arguments LEVEL and MSG, please see function `eask-analyze--write-log' for more information." (let* ((level-string (cl-case level (`error "Error") @@ -80,20 +80,20 @@ information." (if load-file-name (current-column) 0) level-string msg))) - (push (ansi-color-filter-apply log) eask-checker--log))) + (push (ansi-color-filter-apply log) eask-analyze--log))) -(defun eask-checker--write-log (level msg) +(defun eask-analyze--write-log (level msg) "Write the log. Argument LEVEL and MSG are data from the debug log signal." (unless (string= " *temp*" (buffer-name)) ; avoid error from `package-file' directive - (with-current-buffer (or (eask-checker--load-buffer) (buffer-name)) + (with-current-buffer (or (eask-analyze--load-buffer) (buffer-name)) (funcall - (cond ((eask-json-p) #'eask-checker--write-json-format) - (t #'eask-checker--write-plain-text)) + (cond ((eask-json-p) #'eask-analyze--write-json-format) + (t #'eask-analyze--write-plain-text)) level msg)))) -(defun eask-checker--check-file (files) +(defun eask-analyze--file (files) "Lint list of Eask FILES." (let (checked-files content) ;; Linting @@ -105,19 +105,19 @@ Argument LEVEL and MSG are data from the debug log signal." ;; Print result (eask-msg "") (cond ((and (eask-json-p) ; JSON format - (or eask-checker--warnings eask-checker--errors)) + (or eask-analyze--warnings eask-analyze--errors)) (setq content - (eask-checker--pretty-json (json-encode - `((warnings . ,eask-checker--warnings) - (errors . ,eask-checker--errors))))) + (eask-analyze--pretty-json (json-encode + `((warnings . ,eask-analyze--warnings) + (errors . ,eask-analyze--errors))))) (eask-msg content)) - (eask-checker--log ; Plain text + (eask-analyze--log ; Plain text (setq content (with-temp-buffer - (dolist (msg (reverse eask-checker--log)) + (dolist (msg (reverse eask-analyze--log)) (insert msg "\n")) (buffer-string))) - (mapc #'eask-msg (reverse eask-checker--log))) + (mapc #'eask-msg (reverse eask-analyze--log))) (t (eask-info "(Checked %s file%s)" (length checked-files) @@ -131,8 +131,8 @@ Argument LEVEL and MSG are data from the debug log signal." ;;; Program Entry ;; Preparation -(add-hook 'eask-on-error-hook #'eask-checker--write-log) -(add-hook 'eask-on-warning-hook #'eask-checker--write-log) +(add-hook 'eask-on-error-hook #'eask-analyze--write-log) +(add-hook 'eask-on-warning-hook #'eask-analyze--write-log) (let* ((default-directory (cond ((eask-global-p) eask-homedir) ((eask-config-p) user-emacs-directory) @@ -144,7 +144,7 @@ Argument LEVEL and MSG are data from the debug log signal." (cond ;; Files found, do the action! (files - (eask-checker--check-file files)) + (eask-analyze--file files)) ;; Pattern defined, but no file found! (patterns (eask-info "(No files match wildcard: %s)" @@ -154,4 +154,4 @@ Argument LEVEL and MSG are data from the debug log signal." (eask-info "(No Eask-files have been checked)") (eask-help "checker/check-eask")))) -;;; checker/check-eask.el ends here +;;; core/analyze.el ends here diff --git a/lisp/help/checker/check-eask b/lisp/help/core/analyze similarity index 66% rename from lisp/help/checker/check-eask rename to lisp/help/core/analyze index 4c719f67..ca4d89cf 100644 --- a/lisp/help/checker/check-eask +++ b/lisp/help/core/analyze @@ -1,4 +1,4 @@ πŸ’‘ You need to specify file(s) you want to Eask checker to check - $ eask check-eask FILE-1 FILE-2 + $ eask analyze FILE-1 FILE-2 From c988efc3acdd69178f922db4672bbb37ff8fe16e Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 23 Feb 2024 00:40:13 -0800 Subject: [PATCH 2/3] update doc --- CHANGELOG.md | 1 + docs/content/Getting-Started/Basic-Usage/_index.en.md | 4 ++-- docs/content/Getting-Started/Basic-Usage/_index.zh-tw.md | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0330cb0..60015890 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how * fix(build.yml): Release with `.tar.gz` instead of `.zip` on Unix-like system (#214 and #216) * feat: Add `loc` command (#227) * fix: Allow initialize in other scopes (#229) +* feat: Rename command `check-eask` to `analyze` (#230) ## 0.9.x > Released Nov 17, 2023 diff --git a/docs/content/Getting-Started/Basic-Usage/_index.en.md b/docs/content/Getting-Started/Basic-Usage/_index.en.md index 45e5d1f0..8d4e27fc 100644 --- a/docs/content/Getting-Started/Basic-Usage/_index.en.md +++ b/docs/content/Getting-Started/Basic-Usage/_index.en.md @@ -32,6 +32,7 @@ Eask is a command-line tool that helps you build, lint, and test Emacs Lisp pack Usage: eask [options..] Commands: + analyze [files..] Run Eask checker archives List out all package archives [aliases: sources] clean Delete various files produced during building compile [names..] Byte compile all Emacs Lisp files in the package @@ -55,7 +56,7 @@ Commands: load [files..] Load elisp files outdated Show all outdated dependencies package-directory Print path to package directory - package [destination] Build a package artifact, and put it into the given destination + package [destination] Build a package artifact, and put it into the given destination [aliases: pack] recipe Suggest a recipe format refresh Download package archives reinstall [names..] Reinstall packages @@ -65,7 +66,6 @@ Commands: test Run test uninstall [names..] Uninstall packages [aliases: delete] upgrade [names..] Upgrade packages - check-eask [files..] Run eask checker locate Print out Eask installed location upgrade-eask Upgrade Eask itself [aliases: upgrade-self] diff --git a/docs/content/Getting-Started/Basic-Usage/_index.zh-tw.md b/docs/content/Getting-Started/Basic-Usage/_index.zh-tw.md index 85fd4f0c..be4e3762 100644 --- a/docs/content/Getting-Started/Basic-Usage/_index.zh-tw.md +++ b/docs/content/Getting-Started/Basic-Usage/_index.zh-tw.md @@ -29,6 +29,7 @@ Eask is a command-line tool that helps you build, lint, and test Emacs Lisp pack Usage: eask [options..] Commands: + analyze [files..] Run Eask checker archives List out all package archives [aliases: sources] clean Delete various files produced during building compile [names..] Byte compile all Emacs Lisp files in the package @@ -52,7 +53,7 @@ Commands: load [files..] Load elisp files outdated Show all outdated dependencies package-directory Print path to package directory - package [destination] Build a package artifact, and put it into the given destination + package [destination] Build a package artifact, and put it into the given destination [aliases: pack] recipe Suggest a recipe format refresh Download package archives reinstall [names..] Reinstall packages @@ -62,7 +63,6 @@ Commands: test Run test uninstall [names..] Uninstall packages [aliases: delete] upgrade [names..] Upgrade packages - check-eask [files..] Run eask checker locate Print out Eask installed location upgrade-eask Upgrade Eask itself [aliases: upgrade-self] From 6beb514289d2904e613f0506c67e913428e5c44e Mon Sep 17 00:00:00 2001 From: JenChieh Date: Fri, 23 Feb 2024 00:45:19 -0800 Subject: [PATCH 3/3] continue rename check-eask to analyze --- .github/workflows/checker.yml | 2 +- Makefile | 2 +- lisp/_prepare.el | 2 +- lisp/core/analyze.el | 2 +- test/checker/dsl/run.sh | 14 +++++++------- test/checker/metadata/run.sh | 14 +++++++------- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/checker.yml b/.github/workflows/checker.yml index e2f4fa79..cecf0d23 100644 --- a/.github/workflows/checker.yml +++ b/.github/workflows/checker.yml @@ -66,4 +66,4 @@ jobs: - name: Testing... run: | - make command-check-eask + make command-analyze diff --git a/Makefile b/Makefile index 162a71d0..2987d00d 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ command-config: command-local: ./test/commands/local/run.sh -command-check-eask: +command-analyze: ./test/checker/dsl/run.sh ./test/checker/metadata/run.sh diff --git a/lisp/_prepare.el b/lisp/_prepare.el index a45229bf..aa129d68 100644 --- a/lisp/_prepare.el +++ b/lisp/_prepare.el @@ -165,7 +165,7 @@ workspace has no valid Eask-file; it will load global workspace instead." (defun eask-checker-p () "Return t if running Eask as the checker." - (member (eask-command) '("check-eask"))) + (member (eask-command) '("analyze"))) (defun eask-script (script) "Return full SCRIPT filename." diff --git a/lisp/core/analyze.el b/lisp/core/analyze.el index 3dfa9512..4b0b9fea 100644 --- a/lisp/core/analyze.el +++ b/lisp/core/analyze.el @@ -152,6 +152,6 @@ Argument LEVEL and MSG are data from the debug log signal." ;; Default, print help! (t (eask-info "(No Eask-files have been checked)") - (eask-help "checker/check-eask")))) + (eask-help "checker/analyze")))) ;;; core/analyze.el ends here diff --git a/test/checker/dsl/run.sh b/test/checker/dsl/run.sh index ded06381..92386426 100644 --- a/test/checker/dsl/run.sh +++ b/test/checker/dsl/run.sh @@ -17,7 +17,7 @@ ## Commentary: # -# Test command/checker `check-eask` +# Test command/analyze `analyze` # set -e @@ -25,10 +25,10 @@ set -e # Naviate to the test package cd $(dirname "$0") -echo "Testing check-eask command... (Plain text)" -eask check-eask -eask check-eask Eask +echo "Testing analyze command... (Plain text)" +eask analyze +eask analyze Eask -echo "Testing check-eask command... (JSON format)" -eask check-eask --json -eask check-eask Eask --json +echo "Testing analyze command... (JSON format)" +eask analyze --json +eask analyze Eask --json diff --git a/test/checker/metadata/run.sh b/test/checker/metadata/run.sh index ded06381..b73211d5 100644 --- a/test/checker/metadata/run.sh +++ b/test/checker/metadata/run.sh @@ -17,7 +17,7 @@ ## Commentary: # -# Test command/checker `check-eask` +# Test command/checker `analyze` # set -e @@ -25,10 +25,10 @@ set -e # Naviate to the test package cd $(dirname "$0") -echo "Testing check-eask command... (Plain text)" -eask check-eask -eask check-eask Eask +echo "Testing analyze command... (Plain text)" +eask analyze +eask analyze Eask -echo "Testing check-eask command... (JSON format)" -eask check-eask --json -eask check-eask Eask --json +echo "Testing analyze command... (JSON format)" +eask analyze --json +eask analyze Eask --json