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

Actionlint lints all YAML files #591

Closed devkvlt closed 1 month ago

devkvlt commented 1 month ago

https://github.com/mfussenegger/nvim-lint/pull/472 causes Actionlint to lint all YAML files instead of only GitHub action files. This occurs because using stdin prevents Actionlint from automatically detecting the appropriate files to lint. Reverting to the previous commit will resolve this issue.

mfussenegger commented 1 month ago

I don't see it linting other files. Only the stdin.

If you have a linters_by_ft = { yaml = {"actionlint"}} entry it will of course run on all yaml files.

You can avoid that by doing something like:

vim.filetype.add({
  pattern = {
    ['.*/.github/workflows/.*%.yml'] = 'yaml.ghaction',
    ['.*/.github/workflows/.*%.yaml'] = 'yaml.ghaction',
  },
})

And set lint.linters_by_ft = { ghaction = {"actionlint"}}

devkvlt commented 1 month ago

That's a cool trick, thanks.

Yeah I had yaml = {"actionlint"} but it worked fine previously, until I updated the plugin.

I think it might be a good idea to include that trick somewhere in the README, cause it's not really obvious for everyone 😄