handle coverity reports from emacs

Aurélien Aptel aaptel at suse.com
Wed Jan 18 17:21:00 UTC 2017


Hi,

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.

enjoy,

-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)



More information about the samba-technical mailing list