-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathelint.el
More file actions
71 lines (60 loc) · 1.83 KB
/
elint.el
File metadata and controls
71 lines (60 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
;;; lint/elint.el --- Run elint -*- lexical-binding: t; -*-
;;; Commentary:
;;
;; Commmand use to run `elint' for all files
;;
;; $ eask lint elint [files..]
;;
;;
;; Positionals:
;;
;; [files..] files you want elint to run on
;;
;;; Code:
(let ((dir (file-name-directory (nth 1 (member "-scriptload" command-line-args)))))
(load (expand-file-name "_prepare.el"
(locate-dominating-file dir "_prepare.el"))
nil t))
;;
;;; Externals
(declare-function elint-get-log-buffer "ext:elsa.el")
;;
;;; Flags
(advice-add #'eask-allow-error-p :override #'eask-always)
;;
;;; Core
(defun eask-lint-elint--file (filename)
"Run elint on FILENAME."
(let* ((filename (expand-file-name filename))
(file (eask-root-del filename))
(noninteractive))
(eask-lint-first-newline)
(eask-msg "`%s` with elint" (ansi-green file))
(eask-with-verbosity 'debug (elint-file filename))
(let ((log-buffer (elint-get-log-buffer)))
(eask-print-log-buffer log-buffer)
(kill-buffer log-buffer))))
(eask-start
(require 'elint)
(let* ((patterns (eask-args))
(files (if patterns
(eask-expand-file-specs patterns)
(eask-package-el-files))))
(cond
;; Files found, do the action!
(files
(mapcar #'eask-lint-elint--file files)
(eask-msg "")
(eask-info "(Total of %s file%s %s checked)" (length files)
(eask--sinr files "" "s")
(eask--sinr files "has" "have")))
;; Pattern defined, but no file found!
(patterns
(eask-info "(No files match wildcard: %s)"
(mapconcat #'identity patterns " ")))
;; Default, print help!
(t
(eask-msg "")
(eask-info "(No files have been linted)")
(eask-help "lint/elint")))))
;;; lint/elint.el ends here