branch: externals/relint
commit 1ec2d8b17905dfa4ad9eb8729c0be18d8c17bbe0
Author: Mattias Engdegård <[email protected]>
Commit: Mattias Engdegård <[email protected]>
More elaborate parsing of doc strings of global variables
Now detects "When non-nil, specifies a regexp ..."
---
relint.el | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/relint.el b/relint.el
index 66fd0a2..40537b7 100644
--- a/relint.el
+++ b/relint.el
@@ -1302,10 +1302,22 @@ return (NAME); on syntax error, return nil."
(symbol-name name))
(relint--check-rules-list re-arg name file pos (cons 2 path))
(push name relint--checked-variables))
- ;; Doc string starting with "regexp"?
+ ;; Doc string starting with "regexp" etc.
((and (stringp (car rest))
(let ((case-fold-search t))
- (string-match-p (rx bos "regexp") (car rest))))
+ (string-match-p
+ (rx bos
+ (opt (or "when" "if")
+ (* " ")
+ (or "not" "non")
+ (* (any "- "))
+ "nil"
+ (* (any " ,")))
+ (opt (or "specify" "specifies")
+ " ")
+ (opt (or "a" "the" "this") " ")
+ (or "regex" "regular expression"))
+ (car rest))))
(relint--check-re re-arg name file pos (cons 2 path))
(when (eq (car form) 'defcustom)
(relint--check-defcustom-re form name file pos path))