瀏覽代碼

Fix black-check flycheck parser

master
10sr 5 年之前
父節點
當前提交
962d33ba68
簽署人: 10sr GPG Key ID: 7BEC428194130EB2
共有 1 個文件被更改,包括 25 次插入24 次删除
  1. +25
    -24
      emacs.el

+ 25
- 24
emacs.el 查看文件

@@ -2064,30 +2064,31 @@ initializing."

(defun flycheck-parse-black-check (output checker buffer)
"Flycheck parser to check if reformat is required."
(with-temp-buffer
(insert output)
(save-match-data
(goto-char (point-min))
(when (re-search-forward "^would reformat .*$" nil t)
(list (flycheck-error-new-at
(point-min)
nil
'error
;;(format "Black: %s" (match-string 0))
"Black: would be reformatted"
:buffer buffer
:checker checker)))
(goto-char (point-min))
(when (re-search-forward "^error: cannot format .*$" nil t)
(list (flycheck-error-new-at
(point-min)
nil
'error
;; Fix not to include absolute file path
(format "Black: %s" (match-string 0))
:buffer buffer
:checker checker)))
)))
(let ((result nil))
(with-temp-buffer
(insert output)
(save-match-data
(goto-char (point-min))
(when (re-search-forward "^would reformat .*$" nil t)
(setq result (list (flycheck-error-new-at
(point-min)
nil
'error
;;(format "Black: %s" (match-string 0))
"Black: would be reformatted"
:buffer buffer
:checker checker))))
(goto-char (point-min))
(when (re-search-forward "^error: cannot format .*$" nil t)
(setq reslt (list (flycheck-error-new-at
(point-min)
nil
'error
;; Fix not to include absolute file path
(format "Black: %s" (match-string 0))
:buffer buffer
:checker checker))))))
result))

(defun my-flycheck-parse-unified-diff (output checker buffer)
"Flycheck parser to parse diff output."


Loading…
取消
儲存