Skip to content

Commit

Permalink
feat: add buildifier, blade-formatter, blue, haml-lint, textlint, vul…
Browse files Browse the repository at this point in the history
…ture, cfn-lint (#255)

Co-authored-by: William Boman <[email protected]>
  • Loading branch information
thanhvule0310 and williamboman authored Aug 6, 2022
1 parent b425364 commit 5734723
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 6 deletions.
11 changes: 11 additions & 0 deletions lua/mason-registry/blade-formatter/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
local Pkg = require "mason-core.package"
local npm = require "mason-core.managers.npm"

return Pkg.new {
name = "blade-formatter",
desc = [[An opinionated blade template formatter for Laravel that respects readability]],
homepage = "https://github.com/shufo/blade-formatter",
languages = { Pkg.Lang.Blade },
categories = { Pkg.Cat.Formatter },
install = npm.packages { "blade-formatter", bin = { "blade-formatter" } },
}
17 changes: 17 additions & 0 deletions lua/mason-registry/blue/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local Pkg = require "mason-core.package"
local pip3 = require "mason-core.managers.pip3"
local _ = require "mason-core.functional"

return Pkg.new {
name = "blue",
desc = _.dedent [[
blue is a somewhat less uncompromising code formatter than black, the OG of Python formatters. We love the idea
of automatically formatting Python code, for the same reasons that inspired black, however we take issue with
some of the decisions black makes. Kudos to black for pioneering code formatting for Python, and for its
excellent implementation.
]],
homepage = "https://blue.readthedocs.io/en/latest/",
languages = { Pkg.Lang.Python },
categories = { Pkg.Cat.Formatter },
install = pip3.packages { "blue", bin = { "blue" } },
}
34 changes: 34 additions & 0 deletions lua/mason-registry/buildifier/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
local Pkg = require "mason-core.package"
local github = require "mason-core.managers.github"
local std = require "mason-core.managers.std"
local _ = require "mason-core.functional"
local platform = require "mason-core.platform"

local coalesce, when = _.coalesce, _.when

return Pkg.new {
name = "buildifier",
desc = [[buildifier is a tool for formatting and linting bazel BUILD, WORKSPACE, and .bzl files.]],
homepage = "https://github.com/bazelbuild/buildtools",
languages = { Pkg.Lang.Bazel },
categories = { Pkg.Cat.Linter, Pkg.Cat.Formatter },
---@async
---@param ctx InstallContext
install = function(ctx)
github
.download_release_file({
repo = "bazelbuild/buildtools",
out_file = platform.is.win and "buildifier.exe" or "buildifier",
asset_file = coalesce(
when(platform.is.mac_x64, "buildifier-darwin-amd64"),
when(platform.is.mac_arm64, "buildifier-darwin-arm64"),
when(platform.is.linux_x64, "buildifier-linux-amd64"),
when(platform.is.linux_arm64, "buildifier-linux-arm64"),
when(platform.is.win_x64, "buildifier-windows-amd64.exe")
),
})
.with_receipt()
std.chmod("+x", { "buildifier" })
ctx:link_bin("buildifier", platform.is.win and "buildifier.exe" or "buildifier")
end,
}
15 changes: 15 additions & 0 deletions lua/mason-registry/cfn-lint/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
local Pkg = require "mason-core.package"
local pip3 = require "mason-core.managers.pip3"
local _ = require "mason-core.functional"

return Pkg.new {
name = "cfn-lint",
desc = _.dedent [[
CloudFormation Linter. Validate AWS CloudFormation YAML/JSON templates against the AWS CloudFormation Resource
Specification and additional checks. Includes checking valid values for resource properties and best practices.
]],
homepage = "https://github.com/aws-cloudformation/cfn-lint",
languages = { Pkg.Lang.YAML, Pkg.Lang.JSON },
categories = { Pkg.Cat.Linter },
install = pip3.packages { "cfn-lint", bin = { "cfn-lint" } },
}
15 changes: 15 additions & 0 deletions lua/mason-registry/haml-lint/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
local Pkg = require "mason-core.package"
local gem = require "mason-core.managers.gem"
local _ = require "mason-core.functional"

return Pkg.new {
name = "haml-lint",
desc = _.dedent [[
haml-lint is a tool to help keep your HAML files clean and readable. In addition to HAML-specific style and lint
checks, it integrates with RuboCop to bring its powerful static analysis tools to your HAML documents.
]],
homepage = "https://github.com/sds/haml-lint",
languages = { Pkg.Lang.HAML },
categories = { Pkg.Cat.Linter },
install = gem.packages { "haml_lint", bin = { "haml-lint" } },
}
7 changes: 7 additions & 0 deletions lua/mason-registry/index.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ return {
["beancount-language-server"] = "mason-registry.beancount-language-server",
["bicep-lsp"] = "mason-registry.bicep-lsp",
black = "mason-registry.black",
["blade-formatter"] = "mason-registry.blade-formatter",
blue = "mason-registry.blue",
["bsl-language-server"] = "mason-registry.bsl-language-server",
buf = "mason-registry.buf",
buildifier = "mason-registry.buildifier",
["cfn-lint"] = "mason-registry.cfn-lint",
["chrome-debug-adapter"] = "mason-registry.chrome-debug-adapter",
["clang-format"] = "mason-registry.clang-format",
clangd = "mason-registry.clangd",
Expand Down Expand Up @@ -79,6 +83,7 @@ return {
["graphql-language-service-cli"] = "mason-registry.graphql-language-service-cli",
["groovy-language-server"] = "mason-registry.groovy-language-server",
hadolint = "mason-registry.hadolint",
["haml-lint"] = "mason-registry.haml-lint",
["haskell-language-server"] = "mason-registry.haskell-language-server",
["haxe-language-server"] = "mason-registry.haxe-language-server",
["hoon-language-server"] = "mason-registry.hoon-language-server",
Expand Down Expand Up @@ -173,6 +178,7 @@ return {
tectonic = "mason-registry.tectonic",
["terraform-ls"] = "mason-registry.terraform-ls",
texlab = "mason-registry.texlab",
textlint = "mason-registry.textlint",
tflint = "mason-registry.tflint",
["typescript-language-server"] = "mason-registry.typescript-language-server",
["vala-language-server"] = "mason-registry.vala-language-server",
Expand All @@ -184,6 +190,7 @@ return {
["visualforce-language-server"] = "mason-registry.visualforce-language-server",
vls = "mason-registry.vls",
["vue-language-server"] = "mason-registry.vue-language-server",
vulture = "mason-registry.vulture",
["wgsl-analyzer"] = "mason-registry.wgsl-analyzer",
["write-good"] = "mason-registry.write-good",
xo = "mason-registry.xo",
Expand Down
11 changes: 11 additions & 0 deletions lua/mason-registry/textlint/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
local Pkg = require "mason-core.package"
local npm = require "mason-core.managers.npm"

return Pkg.new {
name = "textlint",
desc = [[The pluggable natural language linter for text and markdown.]],
homepage = "https://textlint.github.io",
languages = { Pkg.Lang.Text, Pkg.Lang.Markdown },
categories = { Pkg.Cat.Linter },
install = npm.packages { "textlint", bin = { "textlint" } },
}
19 changes: 19 additions & 0 deletions lua/mason-registry/vulture/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
local Pkg = require "mason-core.package"
local pip3 = require "mason-core.managers.pip3"
local _ = require "mason-core.functional"

return Pkg.new {
name = "vulture",
desc = _.dedent [[
Vulture finds unused code in Python programs. This is useful for cleaning up and finding errors in large code
bases. If you run Vulture on both your library and test suite you can find untested code.
Due to Python's dynamic nature, static code analyzers like Vulture are likely to miss some dead code. Also, code
that is only called implicitly may be reported as unused. Nonetheless, Vulture can be a very helpful tool for
higher code quality.
]],
homepage = "https://github.com/jendrikseipp/vulture",
languages = { Pkg.Lang.Python },
categories = { Pkg.Cat.Linter },
install = pip3.packages { "vulture", bin = { "vulture" } },
}
13 changes: 8 additions & 5 deletions lua/mason/mappings/language.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ return {
astro = { "astro-language-server" },
awk = { "awk-language-server" },
bash = { "bash-debug-adapter", "bash-language-server", "shellcheck", "shellharden", "shfmt" },
bazel = { "buildifier" },
beancount = { "beancount-language-server" },
bicep = { "bicep-lsp" },
blade = { "blade-formatter" },
c = { "clang-format", "clangd", "codelldb", "cpplint", "cpptools" },
["c#"] = { "clang-format", "csharp-language-server", "csharpier", "netcoredbg", "omnisharp", "omnisharp-mono" },
["c++"] = { "clang-format", "clangd", "codelldb", "cpplint", "cpptools" },
Expand Down Expand Up @@ -43,6 +45,7 @@ return {
go = { "delve", "djlint", "go-debug-adapter", "gofumpt", "goimports", "golangci-lint", "golangci-lint-langserver", "golines", "gomodifytags", "gopls", "gotests", "impl", "json-to-struct", "revive", "staticcheck" },
graphql = { "graphql-language-service-cli", "prettier", "prettierd" },
groovy = { "groovy-language-server" },
haml = { "haml-lint" },
handlebargs = { "djlint" },
haskell = { "haskell-language-server" },
haxe = { "haxe-language-server" },
Expand All @@ -51,7 +54,7 @@ return {
java = { "clang-format", "jdtls" },
javascript = { "chrome-debug-adapter", "clang-format", "deno", "eslint-lsp", "eslint_d", "firefox-debug-adapter", "node-debug2-adapter", "prettier", "prettierd", "quick-lint-js", "rome", "typescript-language-server", "xo" },
jinja = { "curlylint", "djlint" },
json = { "clang-format", "fixjson", "jq", "json-lsp", "prettier", "prettierd", "spectral-language-server" },
json = { "cfn-lint", "clang-format", "fixjson", "jq", "json-lsp", "prettier", "prettierd", "spectral-language-server" },
jsonnet = { "jsonnet-language-server" },
jsx = { "prettier", "prettierd" },
julia = { "julia-lsp" },
Expand All @@ -61,7 +64,7 @@ return {
less = { "css-lsp", "prettier", "prettierd" },
liquid = { "curlylint", "shopify-theme-check" },
lua = { "lemmy-help", "lua-language-server", "luacheck", "luaformatter", "selene", "stylua" },
markdown = { "alex", "grammarly-languageserver", "ltex-ls", "markdownlint", "marksman", "prettier", "prettierd", "proselint", "prosemd-lsp", "remark-language-server", "vale", "write-good", "zk" },
markdown = { "alex", "grammarly-languageserver", "ltex-ls", "markdownlint", "marksman", "prettier", "prettierd", "proselint", "prosemd-lsp", "remark-language-server", "textlint", "vale", "write-good", "zk" },
["metamath zero"] = { "metamath-zero-lsp" },
mksh = { "shfmt" },
mustache = { "djlint" },
Expand All @@ -80,7 +83,7 @@ return {
protobuf = { "buf" },
puppet = { "puppet-editor-services" },
purescript = { "purescript-language-server" },
python = { "black", "debugpy", "flake8", "isort", "jedi-language-server", "mypy", "pylint", "pyright", "python-lsp-server", "sourcery" },
python = { "black", "blue", "debugpy", "flake8", "isort", "jedi-language-server", "mypy", "pylint", "pyright", "python-lsp-server", "sourcery", "vulture" },
r = { "r-languageserver" },
reason = { "reason-language-server" },
rescript = { "rescript-lsp" },
Expand All @@ -99,7 +102,7 @@ return {
systemverilog = { "svlangserver", "svls", "verible" },
teal = { "teal-language-server" },
terraform = { "terraform-ls", "tflint" },
text = { "grammarly-languageserver", "ltex-ls", "proselint", "vale" },
text = { "grammarly-languageserver", "ltex-ls", "proselint", "textlint", "vale" },
toml = { "taplo" },
twig = { "curlylint" },
typescript = { "chrome-debug-adapter", "deno", "eslint-lsp", "eslint_d", "firefox-debug-adapter", "node-debug2-adapter", "prettier", "prettierd", "rome", "typescript-language-server", "xo" },
Expand All @@ -110,6 +113,6 @@ return {
vue = { "prettier", "prettierd", "vetur-vls", "vue-language-server" },
wgsl = { "wgsl-analyzer" },
xml = { "lemminx" },
yaml = { "actionlint", "prettier", "prettierd", "spectral-language-server", "yaml-language-server", "yamllint" },
yaml = { "actionlint", "cfn-lint", "prettier", "prettierd", "spectral-language-server", "yaml-language-server", "yamllint" },
zig = { "zls" }
}
4 changes: 3 additions & 1 deletion lua/mason/ui/components/main/package_list.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ end
local function ExpandedPackageInfo(state, pkg, is_installed)
local pkg_state = state.packages.states[pkg.name]
return Ui.CascadingStyleNode({ "INDENT" }, {
Ui.HlTextNode(p.Comment(pkg.spec.desc)),
Ui.HlTextNode(_.map(function(line)
return { p.Comment(line) }
end, _.split("\n", pkg.spec.desc))),
Ui.EmptyLine(),
Ui.Table(_.concat(
_.filter(_.identity, {
Expand Down

0 comments on commit 5734723

Please sign in to comment.