         (cl-sort (delete-dups packages) #'string-lessp :key #'car)))))
 
 (defun doom-cli--ci--lint (commits)
-  (let ((errors? 0)
-        (warnings? 0))
+  (let ((warnings 0)
+        (failures 0))
     (print! (start "Linting %d commits" (length commits)))
     (print-group!
-     (dolist (commit commits)
-       (let* ((plist (doom-cli--parse-commit (cdr commit)))
-              (subject (plist-get plist :subject))
-              warnings errors)
-         (unless (string-match-p "^\\(?:\\(?:fixup\\|squash\\)!\\|FIXUP\\|WIP\\) "
-                                 subject)
-           (dolist (fn doom-cli-commit-rules)
-             (pcase (apply fn plist)
-               (`(,type . ,msg)
-                (push msg (if (eq type 'error) errors warnings)))))
-           (if (and (null errors) (null warnings))
-               (print! (success "%s %s") (substring (car commit) 0 7) subject)
-             (print! (start "%s %s") (substring (car commit) 0 7) subject))
+     (pcase-dolist (`(,ref . ,commitmsg) commits)
+       (let* ((commit   (doom-cli--parse-commit commitmsg))
+              (shortref (substring ref 0 7))
+              (subject  (plist-get commit :subject)))
+         (letf! ((defun skip! (reason &rest args)
+                   (print! (warn "Skipped because: %s") (apply #'format reason args))
+                   (cl-return-from 'linter))
+                 (defun warn! (reason &rest args)
+                   (cl-incf warnings)
+                   (print! (warn "%s") (apply #'format reason args)))
+                 (defun fail! (reason &rest args)
+                   (cl-incf failures)
+                   (print! (error "%s") (apply #'format reason args))))
+           (print! (start "%s %s") shortref subject)
            (print-group!
-            (when errors
-              (cl-incf errors?)
-              (dolist (e (reverse errors))
-                (print! (error "%s" e))))
-            (when warnings
-              (cl-incf warnings?)
-              (dolist (e (reverse warnings))
-                (print! (warn "%s" e)))))))))
-    (when (> warnings? 0)
-      (print! (warn "Warnings: %d") warnings?))
-    (when (> errors? 0)
-      (print! (error "Failures: %d") errors?))
-    (if (not (or (> errors? 0) (> warnings? 0)))
-        (print! (success "There were no issues!"))
-      (terpri)
-      (print! "See https://docs.doomemacs.org/latest/#/developers/conventions/git-commits for details")
-      (when (> errors? 0)
-        (throw 'exit 1)))))
-
-(defun doom-cli--ci--read-commits ()
-  (let (commits)
-    (while (re-search-backward "^commit \\([a-z0-9]\\{40\\}\\)" nil t)
-      (push (cons (match-string 1)
-                  (replace-regexp-in-string
-                   "^    " ""
-                   (save-excursion
-                     (buffer-substring-no-properties
-                      (search-forward "\n\n")
-                      (if (re-search-forward "\ncommit \\([a-z0-9]\\{40\\}\\)" nil t)
-                          (match-beginning 0)
-                        (point-max))))))
-            commits))
-    commits))
+            (cl-block 'linter
+              (mapc (doom-rpartial #'apply commit)
+                    doom-cli-commit-rules)))))))
+    (let ((issues (+ warnings failures)))
+      (if (= issues 0)
+          (print! (success "There were no issues!"))
+        (if (> warnings 0) (print! (warn "Warnings: %d" warnings)))
+        (if (> failures 0) (print! (warn "Failures: %d" failures)))
+        (print! "\nSee https://docs.doomemacs.org/-/conventions/git-commits")
+        (unless (zerop failures)
+          (throw 'exit 1)))
+      t)))
 
 (defun doom-cli--ci-lint-commits (from &optional to)
   (with-temp-buffer
     (insert
      (cdr (doom-call-process
            "git" "log"
-           (format "%s..%s" from (or to "HEAD")))))
-    (doom-cli--ci--lint (doom-cli--ci--read-commits))))
+           (format "%s...%s" from (or to (concat from "~1"))))))
+    (doom-cli--ci--lint
+     (let (commits)
+       (while (re-search-backward "^commit \\([a-z0-9]\\{40\\}\\)" nil t)
+         (push (cons (match-string 1)
+                     (replace-regexp-in-string
+                      "^    " ""
+                      (save-excursion
+                        (buffer-substring-no-properties
+                         (search-forward "\n\n")
+                         (if (re-search-forward "\ncommit \\([a-z0-9]\\{40\\}\\)" nil t)
+                             (match-beginning 0)
+                           (point-max))))))
+               commits))
+       commits))))

    (Boolean) If `t', the commit is declared to contain a breaking change.
    e.g. 'refactor!: this commit breaks everything'
  :body
    (String) Contains the whole BODY of a commit message. This includes the
    subject line (the first line) and the footer.
  :refs
    (List<String>) Contains a list of reference lines, i.e. All Fix, Ref, Close,
    or Revert lines with a valid reference (an URL, commit hash, or valid Github
    issue/PR reference).
  :scopes
    (List<Symbol>) Contains a list of scopes, as symbols. e.g. with
    'feat(org,lsp): so on and so forth', this contains '(org lsp).


(defun doom-cli--ci-hook-pre-push (_remote _url)
  (with-temp-buffer
    (let ((z40 "0000000000000000000000000000000000000000")
          line error)
      (while (setq line (ignore-errors (read-from-minibuffer "")))
        (catch 'continue
          (cl-destructuring-bind (local-ref local-sha remote-ref remote-sha)
              (split-string line " ")
            (unless (or (string-match-p "^refs/heads/\\(master\\|main\\)$" remote-ref)
                        (equal local-sha z40))
              (throw 'continue t))
            (print-group!
             (mapc (lambda (commit)
                     (seq-let (hash msg) (split-string commit "\t")
                       (setq error t)
                       (print! (info "%S commit in %s"
                                     (car (split-string msg " "))
                                     (substring hash 0 12)))))
                   (split-string
                    (cdr (doom-call-process
                          "git" "rev-list"
                          "--grep" (concat "^" (regexp-opt '("WIP" "squash!" "fixup!" "FIXUP") t) " ")
                          "--format=%H\t%s"
                          (if (equal remote-sha z40)
                              local-sha
                            (format "%s..%s" remote-sha local-sha))))
                    "\n" t))
             (when error
               (print! (error "Aborting push due to unrebased WIP, squash!, or fixup! commits"))
               (throw 'exit 1)))))))))


;;
