mfussenegger / nvim-lint

An asynchronous linter plugin for Neovim complementary to the built-in Language Server Protocol support.
GNU General Public License v3.0
1.76k stars 191 forks source link

Add VSG linter #599

Closed fredrikfoss closed 1 week ago

fredrikfoss commented 3 weeks ago

Adds the VHDL Style Guide (VSG) linter.

The linter doesn't autodetect configuration files, so I added functionality to look for .vsg.yaml and .vsg.json in the file's directory and in xdg-config/vsg or ~/.config/vsg. I could not find any mention of a standard name for said files in the documentation, but I read some people using these names and so do I. I'm not sure if this is out of scope, but it is quite nice. Please let me know.

fredrikfoss commented 3 weeks ago

Hi, added some changes to better match with conform.nvim, see #451. Also resolved a bug conserning the discovery of config files.

I'm not very experienced with Lua, but could someone point out why this didn't work:

return {
    cmd = "vsg",
    stdin = true,
    args = function()
        local args = { "-of", "syntastic", "--stdin" }
        local config_file = find_config(vim.fn.expand("%:p:h"))

        if config_file then
            table.insert(args, "-c")
            table.insert(args, config_file)
        end

        return args
    end,
    stream = "stdout",
    ignore_exitcode = true,
    parser = require("lint.parser").from_pattern(pattern, groups, severity_map, {
        source = "vsg",
    }),
}