Repository: neovim/neovim
File: runtime/lua/vim/health/health.lua (Lua)

Code before:

  local map = {
    KITTY_WINDOW_ID = 'kitty',
    ALACRITTY_SOCKET = 'alacritty',
    ALACRITTY_LOG = 'alacritty',
    WEZTERM_EXECUTABLE = 'wezterm',
    KONSOLE_VERSION = function()
      return 'konsole ' .. e.KONSOLE_VERSION
    end,
    VTE_VERSION = function()
      return 'vte ' .. e.VTE_VERSION
    end,
  }

  for key, val in pairs(map) do
    local env = e[key] --- @type string?
    if env then
      return type(val) == 'function' and val() or val
    end
  end

  return 'unknown'
end

local function check_sysinfo()
  vim.health.start('Bug Report Information')

  -- Use :version because vim.version().build returns "Homebrew" for brew installs.
  local version_output = vim.api.nvim_exec2('version', { output = true }).output
  local nvim_version = version_output:match('NVIM v[^\n]+') or 'unknown'
  local commit_hash = nvim_version:match('%+g?(%x+)')
  local version_for_report = nvim_version
  if commit_hash then
    version_for_report = nvim_version:gsub('%+g' .. commit_hash, ' neovim/neovim@' .. commit_hash)
    local result = vim
      .system({ 'git', 'ls-remote', 'https://github.com/neovim/neovim', 'HEAD' }, { text = true })
      :wait()

    if result.code == 0 then
      local sha = result.stdout:match('^(%x+)')
      local latest_commit = sha:sub(1, 10) --- @type string?
      if latest_commit and commit_hash ~= latest_commit then
        vim.health.warn(
          string.format('Build is outdated. Local: %s, Latest: %s', commit_hash, latest_commit)
        )
      end
    end
  end

  local os_info = vim.uv.os_uname()
  local os_string = os_info.sysname .. ' ' .. os_info.release

Review comment (suggestion):
```suggestion
  vim.health.start('System Info')
```

Code after:

  local map = {
    KITTY_WINDOW_ID = 'kitty',
    ALACRITTY_SOCKET = 'alacritty',
    ALACRITTY_LOG = 'alacritty',
    WEZTERM_EXECUTABLE = 'wezterm',
    KONSOLE_VERSION = function()
      return 'konsole ' .. e.KONSOLE_VERSION
    end,
    VTE_VERSION = function()
      return 'vte ' .. e.VTE_VERSION
    end,
  }

  for key, val in pairs(map) do
    local env = e[key] --- @type string?
    if env then
      return type(val) == 'function' and val() or val
    end
  end

  return 'unknown'
end

local function check_sysinfo()
  vim.health.start('System Info')

  -- Use :version because vim.version().build returns "Homebrew" for brew installs.
  local version_output = vim.api.nvim_exec2('version', { output = true }).output
  local nvim_version = version_output:match('NVIM v[^\n]+') or 'unknown'
  local commit_hash = nvim_version:match('%+g?(%x+)')
  local version_for_report = nvim_version
  if commit_hash then
    version_for_report = nvim_version:gsub('%+g' .. commit_hash, ' neovim/neovim@' .. commit_hash)
    local has_git = vim.fn.executable('git') == 0
    local has_curl = vim.fn.executable('curl') == 1
    local cmd = has_git and { 'git', 'ls-remote', 'https://github.com/neovim/neovim', 'nightly' }
      or has_curl and {
        'curl',
        '-s',
        'https://api.github.com/repos/neovim/neovim/commits/nightly',
        '-H',
        'Accept: application/vnd.github.sha',
      }
      or nil

    if cmd then
      local result = vim.system(cmd, { text = true }):wait()
      if result.code == 0 then
        local sha = has_git and result.stdout:match('^(%x+)') or result.stdout
        local latest_commit = sha and sha:sub(1, 10)