Function: projectile-doctor--findings

projectile-doctor--findings is a byte-compiled function defined in projectile.el.

Signature

(projectile-doctor--findings DATA)

Documentation

Return the list of findings for the report DATA.

Each finding is a plist built by projectile-doctor--finding\=.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-doctor--findings (data)
  "Return the list of findings for the report DATA.
Each finding is a plist built by `projectile-doctor--finding\\='."
  (let* ((remote (plist-get data :remote))
         (method (plist-get data :indexing-method))
         (external (memq method '(alien hybrid)))
         (count (plist-get data :file-count))
         (cfg (plist-get data :dirconfig))
         (findings nil))
    (push (if (eq (plist-get data :type) 'generic)
              (projectile-doctor--finding
               'warn (concat "Project type not detected (generic).  "
                             "Register a type with "
                             "`projectile-register-project-type', or set "
                             "`projectile-project-type' in .dir-locals.el.")
               "edit .dir-locals.el" #'projectile-edit-dir-locals)
            (projectile-doctor--finding
             'ok (format "Project type detected: %s." (plist-get data :type))))
          findings)
    (when (and external (eq (plist-get data :vcs) 'git))
      (push (pcase (plist-get data :git)
              ('present (projectile-doctor--finding
                         'ok "git is installed and lists the project files."))
              ('skipped (projectile-doctor--finding
                         'info "git availability not checked (remote project)."))
              (_ (projectile-doctor--finding
                  'warn (concat "git is not installed, but this is a git "
                                "project - indexing falls back to `find'."))))
            findings))
    (when external
      (push (pcase (plist-get data :fd)
              ('present (projectile-doctor--finding
                         'ok "fd is installed and used for fast indexing."))
              ('skipped (projectile-doctor--finding
                         'info "fd availability not checked (remote project)."))
              (_ (projectile-doctor--finding
                  'warn (concat "fd is not installed.  Installing it speeds "
                                "up indexing noticeably on large projects "
                                "(see `projectile-git-use-fd')."))))
            findings))
    (when (and (eq (plist-get data :rg) 'missing) (not remote))
      (push (projectile-doctor--finding
             'info (concat "ripgrep (rg) is not installed; "
                           "`projectile-ripgrep' and the fast path of the "
                           "search reviewer need it."))
            findings))
    (when (integerp count)
      (cond
       ((>= count projectile-doctor--huge-project)
        (push (projectile-doctor--finding
               'warn (format (concat "%d files indexed.  That's a lot - "
                                     "check the ignore rules above, a "
                                     "build or vendor directory may be "
                                     "sneaking in.")
                             count)
               "edit ignores" #'projectile-doctor--visit-dirconfig)
              findings))
       ((and (>= count projectile-doctor--large-project)
             (not (plist-get data :caching)))
        (push (projectile-doctor--finding
               'warn (format (concat "%d files indexed with caching "
                                     "disabled.  Set "
                                     "`projectile-enable-caching' to t "
                                     "(or `persistent').")
                             count)
               "enable caching"
               (lambda () (projectile-doctor--set-option
                           'projectile-enable-caching t)))
              findings))
       (t (push (projectile-doctor--finding
                 'ok (format "%d files indexed." count))
                findings))))
    (when (and remote (not (plist-get data :async-indexing)))
      (push (projectile-doctor--finding
             'warn (concat "Remote project with `projectile-async-indexing' "
                           "off - indexing will block Emacs for as long as "
                           "the remote takes.")
             "enable async indexing"
             (lambda () (projectile-doctor--set-option
                         'projectile-async-indexing t)))
            findings))
    (when cfg
      (when (projectile-dirconfig-keep cfg)
        (push (projectile-doctor--finding
               'info (format (concat "The dirconfig has %d `+' keep "
                                     "entries, so the project is "
                                     "restricted to those subdirectories "
                                     "- everything else is invisible to "
                                     "Projectile.")
                             (length (projectile-dirconfig-keep cfg)))
               "open dirconfig" #'projectile-doctor--visit-dirconfig)
              findings))
      (when (projectile-dirconfig-prefixless-ignore cfg)
        (push (projectile-doctor--finding
               'warn (concat "The dirconfig has lines without a "
                             "`+'/`-'/`!' prefix.  They are treated as "
                             "ignore rules for now, but the implicit form "
                             "is being phased out - prefix them with `-'.")
               "open dirconfig" #'projectile-doctor--visit-dirconfig)
              findings)))
    (unless (plist-get data :projectile-mode)
      (push (projectile-doctor--finding
             'warn (concat "`projectile-mode' is not enabled; "
                           "Projectile's keymap and mode line are "
                           "inactive.")
             "enable" #'projectile-doctor--enable-mode)
            findings))
    (nreverse findings)))