From eff01bc8e73e4913c4a9bbdf60b323bc92480eea Mon Sep 17 00:00:00 2001 From: HybridDog <3192173+HybridDog@users.noreply.github.com> Date: Fri, 9 Jun 2023 19:48:46 +0200 Subject: [PATCH] Add code linting with luacheck (#221) With luacheck mistakes in Lua code can be found, e.g. the use of undefined variables, and the code style can be checked. workflow by @Panquesito7 --- .github/workflows/check.yml | 15 +++++++++++++++ .luacheckrc | 8 ++++++++ 2 files changed, 23 insertions(+) create mode 100644 .github/workflows/check.yml create mode 100644 .luacheckrc diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..3df2d4d --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,15 @@ +on: [push, pull_request] +name: Check + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: apt + run: sudo apt-get install -y luarocks + - name: luacheck install + run: luarocks install --local luacheck + - name: luacheck run + run: $HOME/.luarocks/bin/luacheck ./ diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..14e2168 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,8 @@ +read_globals = {"minetest", "vector", "VoxelArea", "ItemStack", + "table", + "unified_inventory", "sfinv", "smart_inventory", "inventory_plus" +} +globals = {"worldedit"} +-- Ignore these errors until someone decides to fix them +ignore = {"113", "211", "212", "213", "311", "312", "411", "412", "421", "422", + "431", "432", "611", "614", "621", "631"}