From 80366efefdd0133d28c08fb0ede56bf6d8a853d8 Mon Sep 17 00:00:00 2001 From: Niklp Date: Fri, 29 Dec 2023 23:34:24 +0100 Subject: [PATCH] Fix luacheck Fix luacheck warnings in spam.lua Fix global variable initialization (was needed only locally) Add beerchat to luacheck --- .luacheckrc | 3 ++- util/spam.lua | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index fada0ab..6d9e8bc 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -5,7 +5,8 @@ globals = { read_globals = { -- Stdlib string = {fields = {"split"}}, - table = {fields = {"copy", "getn"}}, + table = {fields = {"copy", "getn", "indexof"}}, + beerchat = {fields = {"has_player_muted_player", "execute_callbacks"}}, -- Minetest "minetest", diff --git a/util/spam.lua b/util/spam.lua index e29ef4e..dd8913a 100644 --- a/util/spam.lua +++ b/util/spam.lua @@ -28,7 +28,7 @@ local function words_ratio(str, ratio) end function mail.check_spam(message) - spam_checks = {} + local spam_checks = {} if caps_ratio(message.subject) == 1 or caps_ratio(message.body) > 0.4 then table.insert(spam_checks, "caps") end