From ea6ea0378bd15cc916aa19c907fe731352d1a6e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sat, 11 May 2024 20:13:42 +0200 Subject: [PATCH] github/workflows: add lua linting --- .github/workflows/lint.yml | 6 ++++ .luacheckrc | 60 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .luacheckrc diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4751cb3d20641..425e8d1a07c46 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -27,3 +27,9 @@ jobs: - uses: actions/checkout@v4 - uses: norio-nomura/action-swiftlint@3.2.1 + + lua-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: lunarmodules/luacheck@v1 diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000000000..575e19b8f4766 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,60 @@ +stds = { + mp = { + globals = { + "mp", + "mp.command", + "mp.commandv", + "mp.command_native", + "mp.command_native_async", + "mp.abort_async_command", + "mp.del_property", + "mp.get_property", + "mp.get_property_osd", + "mp.get_property_bool", + "mp.get_property_number", + "mp.get_property_native", + "mp.set_property", + "mp.set_property_bool", + "mp.set_property_number", + "mp.set_property_native", + "mp.get_time", + "mp.add_key_binding", + "mp.add_forced_key_binding", + "mp.remove_key_binding", + "mp.register_event", + "mp.unregister_event", + "mp.observe_property", + "mp.unobserve_property", + "mp.add_timeout", + "mp.add_periodic_timer", + "mp.get_opt", + "mp.get_script_name", + "mp.get_script_directory", + "mp.osd_message", + "mp.get_wakeup_pipe", + "mp.get_next_timeout", + "mp.dispatch_events", + "mp.register_idle", + "mp.unregister_idle", + "mp.enable_messages", + "mp.register_script_message", + "mp.unregister_script_message", + "mp.create_osd_overlay", + "mp.get_osd_size", + "mp.msg.fatal", + "mp.msg.error", + "mp.msg.warn", + "mp.msg.info", + "mp.msg.verbose", + "mp.msg.debug", + "mp.msg.trace", + } + } +} + +std = "+mp" + +ignore = { + "111", -- setting non-standard global variable + "121", -- accessing undefined global variable +}