Function: gitlab-ci--lint-results

gitlab-ci--lint-results is a natively compiled function defined in gitlab-ci-mode.el.

Signature

(gitlab-ci--lint-results STATUS CALLBACK BUFFER)

Documentation

Translate lint API result into data and pass it on.

STATUS is passed from ‘url-retrieve’, and CALLBACK and BUFFER are passed from ‘gitlab-ci-request-lint’, which see.

Source Code

;; Defined in /nix/store/i3kilmgmg3bk0mkr28r6pk0h5mg4s0wd-emacs-packages-deps/share/emacs/site-lisp/elpa/gitlab-ci-mode-20191022.2017/gitlab-ci-mode.el
(defvar url-http-end-of-headers)        ; defined in ‘url/url-http.el’
(defun gitlab-ci--lint-results (status callback buffer)
  "Translate lint API result into data and pass it on.

STATUS is passed from ‘url-retrieve’, and CALLBACK and BUFFER are
passed from ‘gitlab-ci-request-lint’, which see."
  (when (buffer-live-p buffer) ; Don’t bother if the source is dead.
    (condition-case err
        (let ((err (plist-get status :error)))
          (when err
            (signal (car err) (cdr err)))
          (goto-char url-http-end-of-headers)
          (let* ((json-array-type 'list)
                 (data (buffer-substring-no-properties (point) (point-max)))
                 (result (json-read-from-string
                          (decode-coding-string data 'utf-8))))
            (with-current-buffer buffer
              (funcall callback 'finished result))))
      (error (funcall callback 'errored (error-message-string err))))))