From 0e2cd3f01d1e41d4fc912d08399274d270b8ea6c Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Wed, 28 Aug 2024 19:12:10 -0400 Subject: [PATCH] CI: add lua lint check We now have our first lua script so we should start checking that for obvious problems --- .github/workflows/vader.yml | 1 + .luacheckrc | 8 ++++++++ ftdetect/puppet.lua | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .luacheckrc diff --git a/.github/workflows/vader.yml b/.github/workflows/vader.yml index 4dd97a2..559ca1e 100644 --- a/.github/workflows/vader.yml +++ b/.github/workflows/vader.yml @@ -22,6 +22,7 @@ jobs: run: pip install --pre vim-vint - name: Lint vimscript files run: vint --warning --enable-neovim ./after ./autoload ./compiler ./ftdetect ./ftplugin ./indent ./syntax + - uses: lunarmodules/luacheck@v1 - uses: ludeeus/action-shellcheck@master tests: diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..954829a --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,8 @@ +-- vim: ft=lua tw=80 + +-- Global objects defined by the C code +read_globals = { + vim = { + other_fields = true, + } +} diff --git a/ftdetect/puppet.lua b/ftdetect/puppet.lua index 021abc8..11b51a5 100644 --- a/ftdetect/puppet.lua +++ b/ftdetect/puppet.lua @@ -5,8 +5,8 @@ vim.filetype.add({ extension = { epp = function(path, bufnr) - path_wo_epp = path:sub(1,-5) - matched = vim.filetype.match({ buf = bufnr, filename = path_wo_epp }) + local path_wo_epp = path:sub(1,-5) + local matched = vim.filetype.match({ buf = bufnr, filename = path_wo_epp }) if matched ~= nil and matched ~= 'mason' then vim.b.epuppet_subtype = matched end