[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/plz dd491941ab 79/81: Meta: Update makem.sh
From: |
ELPA Syncer |
Subject: |
[elpa] externals/plz dd491941ab 79/81: Meta: Update makem.sh |
Date: |
Wed, 11 May 2022 17:58:04 -0400 (EDT) |
branch: externals/plz
commit dd491941abc0bb2fa1b62975b30a7a0713c5e520
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Meta: Update makem.sh
---
makem.sh | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 65 insertions(+), 15 deletions(-)
diff --git a/makem.sh b/makem.sh
index d1a5edba8f..3985ff7dda 100755
--- a/makem.sh
+++ b/makem.sh
@@ -3,11 +3,11 @@
# * makem.sh --- Script to aid building and testing Emacs Lisp packages
# URL: https://github.com/alphapapa/makem.sh
-# Version: 0.5
+# Version: 0.6-pre
# * Commentary:
-# makem.sh is a script helps to build, lint, and test Emacs Lisp
+# makem.sh is a script that helps to build, lint, and test Emacs Lisp
# packages. It aims to make linting and testing as simple as possible
# without requiring per-package configuration.
@@ -136,6 +136,27 @@ EOF
echo $file
}
+function elisp-elint-file {
+ local file=$(mktemp)
+ cat >$file <<EOF
+(require 'cl-lib)
+(require 'elint)
+(defun makem-elint-file (file)
+ (let ((errors 0))
+ (cl-letf (((symbol-function 'orig-message) (symbol-function 'message))
+ ((symbol-function 'message) (symbol-function 'ignore))
+ ((symbol-function 'elint-output)
+ (lambda (string)
+ (cl-incf errors)
+ (orig-message "%s" string))))
+ (elint-file file)
+ ;; NOTE: \`errors' is not actually the number of errors, because
+ ;; it's incremented for non-error header strings as well.
+ (kill-emacs errors))))
+EOF
+ echo "$file"
+}
+
function elisp-checkdoc-file {
# Since checkdoc doesn't have a batch function that exits non-zero
# when errors are found, we make one.
@@ -234,20 +255,23 @@ Exits non-zero if mis-indented lines are found. Checks
files in
(let ((errors-p))
(cl-labels ((lint-file (file)
(find-file file)
- (let ((tick (buffer-modified-tick)))
- (let ((inhibit-message t))
- (indent-region (point-min) (point-max)))
- (when (/= tick (buffer-modified-tick))
- ;; Indentation changed: warn for each line.
- (dolist (line (undo-lines buffer-undo-list))
- (message "%s:%s: Indentation mismatch"
(buffer-name) line))
- (setf errors-p t))))
+ (let ((inhibit-message t))
+ (indent-region (point-min) (point-max)))
+ (when buffer-undo-list
+ ;; Indentation changed: warn for each line.
+ (dolist (line (undo-lines buffer-undo-list))
+ (message "%s:%s: Indentation mismatch"
(buffer-name) line))
+ (setf errors-p t)))
+ (undo-pos (entry)
+ (cl-typecase (car entry)
+ (number (car entry))
+ (string (abs (cdr entry)))))
(undo-lines (undo-list)
;; Return list of lines changed in UNDO-LIST.
(nreverse (cl-loop for elt in undo-list
- when (and (consp elt)
- (numberp (car elt)))
- collect (line-number-at-pos
(car elt))))))
+ for pos = (undo-pos elt)
+ when pos
+ collect (line-number-at-pos
pos)))))
(mapc #'lint-file (mapcar #'expand-file-name command-line-args-left))
(when errors-p
(kill-emacs 1)))))
@@ -452,8 +476,7 @@ function ert-tests-p {
}
function package-main-file {
- # Echo the package's main file. Helpful for setting
package-lint-main-file.
-
+ # Echo the package's main file.
file_pkg=$(git ls-files ./*-pkg.el 2>/dev/null)
if [[ $file_pkg ]]
@@ -535,6 +558,8 @@ function sandbox {
args_sandbox=(
--title "makem.sh: $(basename $(pwd)) (sandbox: $sandbox_dir)"
--eval "(setq user-emacs-directory (file-truename \"$sandbox_dir\"))"
+ --load package
+ --eval "(setq package-user-dir (expand-file-name \"elpa\"
user-emacs-directory))"
--eval "(setq user-init-file (file-truename \"$init_file\"))"
)
@@ -820,6 +845,9 @@ function lint {
lint-checkdoc
lint-compile
lint-declare
+ # NOTE: Elint doesn't seem very useful at the moment. See comment
+ # in lint-elint function.
+ # lint-elint
lint-indent
lint-package
lint-regexps
@@ -876,6 +904,28 @@ function lint-elsa {
|| error "Linting with Elsa failed."
}
+function lint-elint {
+ # NOTE: Elint gives a lot of spurious warnings, apparently because it
doesn't load files
+ # that are `require'd, so its output isn't very useful. But in case it's
improved in
+ # the future, and since this wrapper code already works, we might as well
leave it in.
+ verbose 1 "Linting with Elint..."
+
+ local errors=0
+ for file in "${files_project_feature[@]}"
+ do
+ verbose 2 "Linting with Elint: $file..."
+ run_emacs \
+ --load "$(elisp-elint-file)" \
+ --eval "(makem-elint-file \"$file\")" \
+ && verbose 3 "Linting with Elint found no errors." \
+ || { error "Linting with Elint failed: $file"; ((errors++)) ; }
+ done
+
+ [[ $errors = 0 ]] \
+ && success "Linting with Elint finished without errors." \
+ || error "Linting with Elint failed."
+}
+
function lint-indent {
verbose 1 "Linting indentation..."
- [elpa] externals/plz 7478d43668 51/81: Revert "Add/Change: Handle LF-only HTTP responses", (continued)
- [elpa] externals/plz 7478d43668 51/81: Revert "Add/Change: Handle LF-only HTTP responses", ELPA Syncer, 2022/05/11
- [elpa] externals/plz 8d2654bba7 49/81: Add/Change: Handle LF-only HTTP responses, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 220f882ee4 53/81: Tests: (plz-post-jpeg-string) Add, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 4a246e24f6 54/81: Add: Upload binary files, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 7c27e4bdcd 61/81: Change: Sync with accept-process-output, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 65030d5cc1 64/81: Tidy: Docstring, ELPA Syncer, 2022/05/11
- [elpa] externals/plz dd92f48895 65/81: Change: Default to :then 'sync and :as 'string, ELPA Syncer, 2022/05/11
- [elpa] externals/plz cddccccf81 67/81: Docs: Fix link, ELPA Syncer, 2022/05/11
- [elpa] externals/plz f1a89a8816 68/81: Add: Download :as file, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 8cd1ef481d 73/81: Notes: Add links to skeeto's feedback, ELPA Syncer, 2022/05/11
- [elpa] externals/plz dd491941ab 79/81: Meta: Update makem.sh,
ELPA Syncer <=
- [elpa] externals/plz da503527d2 76/81: Change: (plz--response) Error if unable to parse HTTP response, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 0a860d94dc 71/81: Tests: "There be dragons.", ELPA Syncer, 2022/05/11
- [elpa] externals/plz ce7afc17f9 63/81: Meta: Ignore .sandbox/, ELPA Syncer, 2022/05/11
- [elpa] externals/plz 4736d5242a 66/81: Tests: (plz-test-wait) Change to function, test process argument, ELPA Syncer, 2022/05/11