-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
109 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Copyright (C) 2022 Jen-Chieh Shen | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3, or (at your option) | ||
* any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with GNU Emacs; see the file COPYING. If not, write to the | ||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
* Boston, MA 02110-1301, USA. | ||
*/ | ||
|
||
"use strict"; | ||
|
||
exports.command = ['regexps [files..]', 'lint-regexps [files..]', 'relint [files..]']; | ||
exports.desc = 'run relint'; | ||
exports.builder = { | ||
files: { | ||
description: 'files you want relint to run on', | ||
requiresArg: false, | ||
type: 'array', | ||
}, | ||
}; | ||
|
||
exports.handler = async (argv) => { | ||
await UTIL.e_call(argv, 'lint/regexps', argv.files); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
;;; regexps.el --- Lint the package using `relint' -*- lexical-binding: t; -*- | ||
|
||
;;; Commentary: | ||
;; | ||
;; Commmand use to run `relint' for all files | ||
;; | ||
;; $ eask regexps [names..] | ||
;; | ||
;; | ||
;; Initialization options: | ||
;; | ||
;; [names..] files you want relint to run on | ||
;; | ||
|
||
;;; Code: | ||
|
||
(load (expand-file-name | ||
"../_prepare.el" | ||
(file-name-directory (nth 1 (member "-scriptload" command-line-args)))) | ||
nil t) | ||
|
||
(defun eask--relint-file (filename) | ||
"Package lint FILENAME." | ||
(let* ((filename (expand-file-name filename)) | ||
(file (eask-root-del filename)) | ||
(errors)) | ||
(eask-msg "") | ||
(eask-msg "`%s` with relint" (ansi-green file)) | ||
(with-current-buffer (find-file filename) | ||
(setq errors (relint-buffer (current-buffer))) | ||
(dolist (err errors) | ||
(let* ((msg (nth 0 err)) | ||
(error-pos (nth 2 err)) | ||
(severity (nth 5 err)) | ||
(report-func (pcase severity | ||
(`error #'eask-error) | ||
(`warning #'eask-warn)))) | ||
(funcall report-func "%s:%s %s: %s" | ||
file (line-number-at-pos error-pos) | ||
(capitalize (eask-2str severity)) msg))) | ||
(kill-this-buffer)))) | ||
|
||
(eask-start | ||
(eask-with-archives "gnu" | ||
(eask-package-install 'relint)) | ||
(if-let ((files (if (eask-args) | ||
(eask-expand-file-specs (eask-args)) | ||
(eask-package-el-files)))) | ||
(progn | ||
(setq package-lint-main-file eask-package-file) | ||
(mapcar #'eask--relint-file files) | ||
(eask-info "(Total of %s files linted)" (length files))) | ||
(eask-info "(No files have been linted)") | ||
(if (eask-args) | ||
(eask--print-no-matching-files) | ||
(eask-help 'regexps)))) | ||
|
||
;;; regexps.el ends here |