bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5126: 23.1; checkdoc-comment-style-hooks stops at first error


From: Andrew Hyatt
Subject: bug#5126: 23.1; checkdoc-comment-style-hooks stops at first error
Date: Tue, 20 Aug 2019 13:21:46 -0400

The bug report is saying that not all checks are run. If you trace your
functions you tested with and run checkdoc, you will find that foobaz is
checked for but not foobar. So not all checks are run. The author of the
bug wants both checked for.

Maybe this bug should be a feature request instead.

Or, maybe it's not a good idea to even do all the checks when only one
error message will be printed.  I'm not sure why the author of the bug
thought this was a problem, to be honest.

If someone understands what the benefit would be of running
all checks, please share that info.  Otherwise, I'm happy to close this
bug in a few weeks if we don't hear anything.

On Fri, Aug 16, 2019 at 3:14 PM Alex Branham <alex.branham@gmail.com> wrote:
On Sat 09 Jul 2016 at 09:27, Andrew Hyatt <ahyatt@gmail.com> wrote:

> This still is the case in Emacs 25. I agree that this seems like a
> problem.
>
> Kevin Ryde <user42@zip.com.au> writes:
>
>> checkdoc-comment-style-hooks is run by checkdoc-file-comments-engine
>> with run-hook-with-args-until-success, which means if one of the hook
>> functions returns an error string (as described in the hook's docstring)
>> then no further functions are run.

Maybe I'm misunderstanding this bug report, but this works for me:

;; foobar
(defun my/checkdoc-comments-foobar ()
  "Check if foobar is in a comment."
  (save-excursion
    (goto-char (point-min))
    (unless (re-search-forward "^;; foobar" nil t)
      (checkdoc-create-error
       ";; foobar doesn't exist"
       (1- (point-max)) (point-max)))))

(defun my/checkdoc-comments-foobaz ()
  "Check if foobaz is in a comment."
  (save-excursion
    (goto-char (point-min))
    (unless (re-search-forward "^;; foobaz" nil t)
      (checkdoc-create-error
       ";; foobaz doesn't exist"
       (1- (point-max)) (point-max)))))

(add-hook 'checkdoc-comment-style-functions #'my/checkdoc-comments-foobar)
(add-hook 'checkdoc-comment-style-functions #'my/checkdoc-comments-foobaz)

Now checkdoc warns that foobaz is missing. You can change foobar to
foobaz and it warns that foobar is missing. Can we close this bug report?

Alex

reply via email to

[Prev in Thread] Current Thread [Next in Thread]