handle coverity reports from emacs
Ralph Böhme
slow at samba.org
Wed Jan 18 17:55:17 UTC 2017
On Wed, Jan 18, 2017 at 06:21:00PM +0100, Aurélien Aptel wrote:
> If you use emacs and get the Coverity reports emails here's a quick
> function that applies the error font face to the error messages and lets
> you browse the reports using regular jump-to-next-error key (C-x `) to
> jump to the problematic code.
>
> (defun samba-coverity ()
> (interactive)
> (let ((b (get-buffer-create "*coverity*")))
> (with-current-buffer b
> (erase-buffer)
> ;; put the path to the source here vvvvvvvvvvvvvvvvvv
> (setq default-directory (expand-file-name "~/prog/samba-git"))
> ;; put the email command here vvvvvvv
> (insert (shell-command-to-string "<CMD>"))
> (goto-char (point-min))
> (while (search-forward-regexp (rx bol ">>>") nil t)
> (let ((beg (save-excursion (beginning-of-line) (point)))
> (end (save-excursion (end-of-line) (point))))
> (put-text-property beg end 'face 'error)))
> (goto-char (point-min))
> (compilation-minor-mode))
> (switch-to-buffer b)))
>
>
> I use notmuch to handle my emails, with this command to output the ones
> sent by Coverity in a human readable format (decoded), with a small perl
> filter to convert the source location to the GNU style
> ("program:/path/source:line-number: msg").
>
> for i in $(notmuch search --output=messages 'from:scan-admin at coverity.com'); do
> notmuch show $i;
> done | perl -pE 's,^/(\S+): (\d+) in,cov:$1:$2: in,'
>
> Don't forget to backslash any backslashes in your cmd when you put it
> in an elisp string.
Aurélien, this is amazing! :) I'm going to give it a try in the next days.
I'm so glad you use emacs not vim. ;)
Cheerio!
-slow
More information about the samba-technical
mailing list