From faef0fc58264fcd72a8b52a4e7403895383bd714 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Wed, 14 Feb 2018 13:50:39 +0200 Subject: [PATCH] [Minor] Silence luacheck --- lualib/rspamd_config_transform.lua | 2 +- lualib/stat_tools.lua | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lualib/rspamd_config_transform.lua b/lualib/rspamd_config_transform.lua index 6b9e0ec27..636372988 100644 --- a/lualib/rspamd_config_transform.lua +++ b/lualib/rspamd_config_transform.lua @@ -155,7 +155,7 @@ local function symbol_transform(cfg, k, v) -- Now check what Rspamd knows about this symbol local sym = rspamd_config:get_metric_symbol(k) - if not k or not k.group then + if not sym or not sym.group then -- Otherwise we just use group 'ungrouped' if not cfg.group.ungrouped then cfg.group.ungrouped = { diff --git a/lualib/stat_tools.lua b/lualib/stat_tools.lua index 7c5834025..48ecb1be4 100644 --- a/lualib/stat_tools.lua +++ b/lualib/stat_tools.lua @@ -16,12 +16,11 @@ limitations under the License. local logger = require "rspamd_logger" local sqlite3 = require "rspamd_sqlite3" -local redis = require "rspamd_redis" local util = require "rspamd_util" local lua_redis = require "lua_redis" local exports = {} -local N = "stats_tools" +local N = "stat_tools" -- luacheck: ignore (maybe unused) -- Performs synchronous conversion of redis schema local function convert_bayes_schema(redis_params, symbol_spam, symbol_ham, expire) @@ -35,7 +34,7 @@ local function convert_bayes_schema(redis_params, symbol_spam, symbol_ham, expi -- So we can expire individual records, measure most popular elements by zranges, -- add new fields, such as tokens etc - local res,conn,_ = lua_redis.redis_connect_sync(redis_params, true) + local res,conn = lua_redis.redis_connect_sync(redis_params, true) if not res then logger.errx("cannot connect to redis server") @@ -67,7 +66,8 @@ return nconverted ]] conn:add_cmd('EVAL', {lua_script, '3', symbol_spam, 'S', tostring(expire)}) - local ret, res = conn:exec() + local ret + ret, res = conn:exec() if not ret then logger.errx('error converting symbol %s', symbol_spam) @@ -105,7 +105,7 @@ end ]] conn:add_cmd('EVAL', {lua_script, '2', symbol_spam, 'learns_spam'}) - local ret, _ = conn:exec() + ret = conn:exec() if not ret then logger.errx('error converting metadata for symbol %s', symbol_spam) @@ -113,7 +113,7 @@ end end conn:add_cmd('EVAL', {lua_script, '2', symbol_ham, 'learns_ham'}) - local ret, _ = conn:exec() + ret = conn:exec() if not ret then logger.errx('error converting metadata for symbol %s', symbol_ham) @@ -156,7 +156,7 @@ local function convert_sqlite_to_redis(redis_params, return false end - local res,conn,_ = lua_redis.redis_connect_sync(redis_params, true) + local res,conn = lua_redis.redis_connect_sync(redis_params, true) if not res then logger.errx("cannot connect to redis server") -- 2.39.5