[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/relint 12a2b0f 08/21: Use regexp in suppression comment
From: |
Mattias Engdegård |
Subject: |
[elpa] externals/relint 12a2b0f 08/21: Use regexp in suppression comments |
Date: |
Sun, 3 May 2020 11:13:36 -0400 (EDT) |
branch: externals/relint
commit 12a2b0fafdba26526e2b166a322a6171fac19cc4
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>
Use regexp in suppression comments
This adds flexibility, in particular for coping with different quoting
styles.
---
README | 6 +++---
relint.el | 10 +++++-----
test/6.elisp | 4 ++--
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/README b/README
index 3ca9499..7a355c4 100644
--- a/README
+++ b/README
@@ -265,10 +265,10 @@ skip-syntax-backward.
To suppress such diagnostics, add a comment on the form
- ;; relint suppression: MESSAGE
+ ;; relint suppression: REGEXP
- on the line before the code where the error occurred. MESSAGE is a
- substring of the message to be suppressed. Multiple suppression
+ on the line before the code where the error occurred. REGEXP
+ matches the message to be suppressed. Multiple suppression
comment lines can precede a line of code to eliminate several
complaints on the same line.
diff --git a/relint.el b/relint.el
index d5b329e..b17d451 100644
--- a/relint.el
+++ b/relint.el
@@ -209,9 +209,9 @@ or nil if no position could be determined."
(save-excursion
;; On a preceding line, look for a comment on the form
;;
- ;; relint suppression: SUBSTRING
+ ;; relint suppression: REGEXP
;;
- ;; where SUBSTRING is a substring of MESSAGE. There can be
+ ;; where REGEXP matches MESSAGE. There can be
;; multiple suppression lines preceding a line of code with
;; several errors.
(goto-char pos)
@@ -221,11 +221,11 @@ or nil if no position could be determined."
(not (setq matched
(and
(looking-at (rx (0+ blank) (1+ ";") (0+ blank)
- "relint suppression:" (0+ blank)
+ "relint suppression:" (1+ blank)
(group (0+ nonl)
(not (any "\n" blank)))))
- (let ((substr (match-string 1)))
- (string-match-p (regexp-quote substr) message)))))
+ (let ((regexp (match-string 1)))
+ (string-match-p regexp message)))))
(looking-at (rx bol
(0+ blank) (opt ";" (0+ nonl))
eol))
diff --git a/test/6.elisp b/test/6.elisp
index ac07fc1..cbbdf4b 100644
--- a/test/6.elisp
+++ b/test/6.elisp
@@ -48,8 +48,8 @@
;; Test suppression
(defun test-suppression ()
- ;; relint suppression: Unescaped literal `$'
- ;; relint suppression: Duplicated `a'
+ ;; relint suppression: Unescaped literal .\$
+ ;; relint suppression: Duplicated .a
(looking-at "$[aa]"))
;; Test user-defined regexp-generating functions
- [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, 2020/05/03
- [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 <=
- [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
- [elpa] externals/relint 1bf7f25 13/21: Check auto-mode-alist with file-specific checks, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 4fcc322 16/21: Delay call to file-relative-name until needed, Mattias Engdegård, 2020/05/03
- [elpa] externals/relint 326cfe2 11/21: Check calls to directory-files(-and-attributes), Mattias Engdegård, 2020/05/03