Skip to content

Commit

Permalink
Merge pull request #6 from catgoose/main
Browse files Browse the repository at this point in the history
Check for already installing linter and unknown linter
  • Loading branch information
rshkarin authored Jul 13, 2024
2 parents 9eabd49 + de4fc36 commit b9ae43a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions lua/mason-nvim-lint/auto_install.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ local settings = require "mason-nvim-lint.settings"
--@return unknown_linters string[]
local function auto_install()
local unknown_linters = {}
local installing_linters = {}

for _, linter_names in pairs(nvim_lint.linters_by_ft) do
for _, linter_name in ipairs(linter_names) do
local mason_linter_identifier = mapping.nvimlint_to_package[linter_name]
if mason_linter_identifier then
require "mason-nvim-lint.install".try_install(mason_linter_identifier)
if not vim.tbl_contains(installing_linters, mason_linter_identifier) then
table.insert(installing_linters, mason_linter_identifier)
require "mason-nvim-lint.install".try_install(mason_linter_identifier)
end
else
table.insert(unknown_linters, linter_name)
if not vim.tbl_contains(unknown_linters, linter_name) then
table.insert(unknown_linters, linter_name)
end
end
end
end
Expand Down
6 changes: 5 additions & 1 deletion lua/mason-nvim-lint/mapping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ M.nvimlint_to_package = {
["ansible_lint"] = "ansible-lint",
["buf_lint"] = "buf",
["buildifier"] = "buildifier",
["cbfmt"] = "cbfmt",
["cfn_lint"] = "cfn-lint",
["checkstyle"] = "checkstyle",
["checkmake"] = "checkmake",
Expand All @@ -17,6 +18,7 @@ M.nvimlint_to_package = {
["cspell"] = "cspell",
["curlylint"] = "curlylint",
["djlint"] = "djlint",
["editorconfig-checker"] = "editorconfig-checker",
["erb_lint"] = "erb-lint",
["eslint_d"] = "eslint_d",
["flake8"] = "flake8",
Expand All @@ -40,16 +42,18 @@ M.nvimlint_to_package = {
["ruff"] = "ruff",
["selene"] = "selene",
["shellcheck"] = "shellcheck",
["shellharden"] = "shellharden",
["solhint"] = "solhint",
["sqlfluff"] = "sqlfluff",
["standardrb"] = "standardrb",
["stylelint"] = "stylelint",
["solhint"] = "solhint",
["tflint"] = "tflint",
["tfsec"] = "tfsec",
["trivy"] = "trivy",
["vale"] = "vale",
["vint"] = "vint",
["vulture"] = "vulture",
["write-good"] = "write-good",
["yamllint"] = "yamllint",
}

Expand Down
1 change: 1 addition & 0 deletions lua/mason-nvim-lint/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ local DEFAULT_SETTINGS = {
automatic_installation = true,

-- Disables warning notifications about misconfigurations such as invalid linter entries and incorrect plugin load order.
---@type boolean
quiet_mode = false,
}

Expand Down

0 comments on commit b9ae43a

Please sign in to comment.