[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/relint 96e26a5 02/21: Check keyword arguments :regexp a
From: |
Mattias Engdegård |
Subject: |
[elpa] externals/relint 96e26a5 02/21: Check keyword arguments :regexp and :regex |
Date: |
Sun, 3 May 2020 11:13:34 -0400 (EDT) |
branch: externals/relint
commit 96e26a5f8f3967cf5b1e181831e94860f2be6c74
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>
Check keyword arguments :regexp and :regex
---
relint.el | 8 +++++++-
test/2.elisp | 4 ++++
test/2.expected | 6 ++++++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/relint.el b/relint.el
index 567315c..bc4a9af 100644
--- a/relint.el
+++ b/relint.el
@@ -1965,11 +1965,17 @@ directly."
;; mutables since all args are evaluated once.
(let ((index 0))
(while (consp form)
- (when (consp (car form))
+ (cond
+ ((consp (car form))
;; Check subforms with the assumption that nothing can be mutated,
;; since we don't really know what is evaluated when.
(relint--check-form-recursively-2
(car form) nil file pos (cons index path)))
+ ((and (memq (car form) '(:regexp :regex))
+ (consp (cdr form)))
+ (relint--check-re (cadr form)
+ (format "%s parameter" (car form))
+ file pos (cons (1+ index) path))))
(setq form (cdr form))
(setq index (1+ index)))))))
diff --git a/test/2.elisp b/test/2.elisp
index 1a2c4ea..a96cef0 100644
--- a/test/2.elisp
+++ b/test/2.elisp
@@ -50,3 +50,7 @@
(defun f6 ()
(f5 "[aa]" "[bb]" "[cc]" "[dd]" "[ee]"))
+
+(defun f7 ()
+ (alpha beta :regexp "[11]")
+ (gamma :regex "[22]" delta))
diff --git a/test/2.expected b/test/2.expected
index 0bde370..0dbcfc8 100644
--- a/test/2.expected
+++ b/test/2.expected
@@ -133,3 +133,9 @@
2.elisp:52:31: In call to f5: Duplicated `d' inside character alternative (pos
2)
"[dd]"
..^
+2.elisp:55:26: In :regexp parameter: Duplicated `1' inside character
alternative (pos 2)
+ "[11]"
+ ..^
+2.elisp:56:20: In :regex parameter: Duplicated `2' inside character
alternative (pos 2)
+ "[22]"
+ ..^
- [elpa] externals/relint updated (83e677d -> a001a05), Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 96e26a5 02/21: Check keyword arguments :regexp and :regex,
Mattias Engdegård <=
- [elpa] externals/relint ba7b747 01/21: Display the number of files found in relint-directory, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint b694c09 07/21: Check split ASCII-raw ranges in rx correctly, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 12a2b0f 08/21: Use regexp in suppression comments, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 9259a5c 03/21: Check some :value parameters in defcustom :type clauses, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint ac75b62 04/21: Check rx-to-string, and the 'regexp' and 'eval' subforms, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 09ef3df 05/21: Describe the new xr wrapped subsumption warning, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint eb178d5 06/21: Check assignments to imenu-generic-expression, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 2eba4d7 09/21: Describe new bol/eol/eos warnings, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint cf2a2ae 14/21: Do file-specific checks on arguments to known functions, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint f6d0fed 15/21: Describe the new file-specific warnings, Mattias Engdegård, 2020/05/03