Function: bazel--make-diagnostics

bazel--make-diagnostics is a natively compiled function defined in bazel.el.

Signature

(bazel--make-diagnostics OUTPUT-BUFFER)

Documentation

Return Flymake diagnostics for the Buildifier report in OUTPUT-BUFFER.

OUTPUT-BUFFER should contain a JSON report for the file visited by the current buffer as described in URL
‘https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md#file-diagnostics-in-json’.
All filenames in OUTPUT-BUFFER are ignored; all messages are attached to the current buffer. Return a list of Flymake diagnostics; see Info node (Flymake) Backend functions for details.

Source Code

;; Defined in /nix/store/ws8pkszjvcad1rgzqw6wja7qxacylfhn-emacs-packages-deps/share/emacs/site-lisp/elpa/bazel-20261002.1510/bazel.el
(defun bazel--make-diagnostics (output-buffer)
  "Return Flymake diagnostics for the Buildifier report in OUTPUT-BUFFER.
OUTPUT-BUFFER should contain a JSON report for the file visited
by the current buffer as described in URL
‘https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md#file-diagnostics-in-json’.
All filenames in OUTPUT-BUFFER are ignored; all messages are
attached to the current buffer.  Return a list of Flymake
diagnostics; see Info node ‘(Flymake) Backend functions’ for
details."
  (declare (ftype (function (buffer) list)))
  (cl-check-type output-buffer buffer)
  (cl-loop with report = (with-current-buffer output-buffer
                           (save-excursion
                             (without-restriction
                               (goto-char (point-min))
                               ;; Skip over standard error messages if possible.
                               (let ((case-fold-search nil)
                                     (search-spaces-regexp nil))
                                 (when (re-search-forward (rx bol ?{) nil t)
                                   (backward-char)
                                   (bazel--json-parse-buffer))))))
           for file across (gethash "files" report)
           nconc (cl-loop for warning across (gethash "warnings" file)
                          collect (bazel--diagnostic-for-warning warning))))