diff options
-rw-r--r-- | .luacheckrc | 11 | ||||
-rw-r--r-- | net/adns.lua | 1 | ||||
-rw-r--r-- | net/dns.lua | 8 | ||||
-rw-r--r-- | net/server_select.lua | 4 | ||||
-rw-r--r-- | plugins/mod_admin_telnet.lua | 5 | ||||
-rw-r--r-- | plugins/mod_presence.lua | 2 | ||||
-rw-r--r-- | tests/test_util_jid.lua | 2 | ||||
-rw-r--r-- | tests/test_util_multitable.lua | 4 |
8 files changed, 23 insertions, 14 deletions
diff --git a/.luacheckrc b/.luacheckrc index 590f9c37..2fc05e75 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -10,3 +10,14 @@ ignore = { "411/err", "421/err", "411/ok", "421/ok", "211/_ENV" } files["plugins/"] = { ignore = { "122/module" }; } +files["tests/"] = { + ignore = { + "113/assert_equal", + "113/assert_table", + "113/assert_function", + "113/assert_string", + "113/assert_boolean", + "113/assert_is", + "113/assert_is_not", + }; +} diff --git a/net/adns.lua b/net/adns.lua index d3da2065..0b7247ed 100644 --- a/net/adns.lua +++ b/net/adns.lua @@ -11,7 +11,6 @@ local dns = require "net.dns"; local log = require "util.logger".init("adns"); -local t_insert, t_remove = table.insert, table.remove; local coroutine, tostring, pcall = coroutine, tostring, pcall; local function dummy_send(sock, data, i, j) return (j-i)+1; end diff --git a/net/dns.lua b/net/dns.lua index 689020a4..4a35fc1b 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -190,7 +190,7 @@ end local rrs_metatable = {}; -- - - - - - - - - - - - - - - - - - rrs_metatable function rrs_metatable.__tostring(rrs) local t = {}; - for i,rr in ipairs(rrs) do + for _, rr in ipairs(rrs) do append(t, tostring(rr)..'\n'); end return table.concat(t); @@ -841,7 +841,7 @@ function resolver:receive(rset) -- - - - - - - - - - - - - - - - - receive rset = rset or self.socket; local response; - for i,sock in pairs(rset) do + for _, sock in pairs(rset) do if self.socketset[sock] then local packet = sock:receive(); @@ -852,7 +852,7 @@ function resolver:receive(rset) -- - - - - - - - - - - - - - - - - receive --print('received response'); --self.print(response); - for j,rr in pairs(response.answer) do + for _, rr in pairs(response.answer) do if rr.name:sub(-#response.question[1].name, -1) == response.question[1].name then self:remember(rr, response.question[1].type) end @@ -894,7 +894,7 @@ function resolver:feed(sock, packet, force) --print('received response'); --self.print(response); - for j,rr in pairs(response.answer) do + for _, rr in pairs(response.answer) do self:remember(rr, response.question[1].type); end diff --git a/net/server_select.lua b/net/server_select.lua index 37d57d29..f70f81d0 100644 --- a/net/server_select.lua +++ b/net/server_select.lua @@ -904,7 +904,7 @@ loop = function(once) -- this is the main loop of the program end local read, write, err = socket_select( _readlist, _sendlist, math_min(_selecttimeout, next_timer_time) ) - for i, socket in ipairs( write ) do -- send data waiting in writequeues + for _, socket in ipairs( write ) do -- send data waiting in writequeues local handler = _socketlist[ socket ] if handler then handler.sendbuffer( ) @@ -913,7 +913,7 @@ loop = function(once) -- this is the main loop of the program out_put "server.lua: found no handler and closed socket (writelist)" -- this should not happen end end - for i, socket in ipairs( read ) do -- receive data + for _, socket in ipairs( read ) do -- receive data local handler = _socketlist[ socket ] if handler then handler.readbuffer( ) diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index 4f11d8ea..dd583663 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -769,7 +769,6 @@ local function print_errors(print, errors) end function def_env.s2s:showcert(domain) - local ser = require "util.serialization".serialize; local print = self.session.print; local s2s_sessions = module:shared"/*/s2s/sessions"; local domain_sessions = set.new(array.collect(values(s2s_sessions))) @@ -994,11 +993,11 @@ local function check_muc(jid) end function def_env.muc:create(room_jid) - local room, host = check_muc(room_jid); + local room_name, host = check_muc(room_jid); if not room_name then return room_name, host; end - if not room then return nil, host end + if not room_name then return nil, host end if hosts[host].modules.muc.rooms[room_jid] then return nil, "Room exists already" end return hosts[host].modules.muc.create_room(room_jid); end diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index cf762edc..e4a317bc 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -130,7 +130,7 @@ function send_presence_of_available_resources(user, host, jid, recipient_session if h and h.type == "local" then local u = h.sessions[user]; if u then - for k, session in pairs(u.sessions) do + for _, session in pairs(u.sessions) do local pres = session.presence; if pres then if stanza then pres = stanza; pres.attr.from = session.full_jid; end diff --git a/tests/test_util_jid.lua b/tests/test_util_jid.lua index c697e63f..0ac5827e 100644 --- a/tests/test_util_jid.lua +++ b/tests/test_util_jid.lua @@ -19,7 +19,7 @@ end function split(split) - function test(input_jid, expected_node, expected_server, expected_resource) + local function test(input_jid, expected_node, expected_server, expected_resource) local rnode, rserver, rresource = split(input_jid); assert_equal(expected_node, rnode, "split("..tostring(input_jid)..") failed"); assert_equal(expected_server, rserver, "split("..tostring(input_jid)..") failed"); diff --git a/tests/test_util_multitable.lua b/tests/test_util_multitable.lua index 71a83450..4a8dd14c 100644 --- a/tests/test_util_multitable.lua +++ b/tests/test_util_multitable.lua @@ -8,7 +8,7 @@ function new(new, multitable) - mt = new(); + local mt = new(); assert_table(mt, "Multitable is a table"); assert_function(mt.add, "Multitable has method add"); assert_function(mt.get, "Multitable has method get"); @@ -40,7 +40,7 @@ function get(get, multitable) return assert_equal(select(2, has_items(list, ...)), "has-all", message or "List has all expected items, and no more", 2); end - mt = multitable.new(); + local mt = multitable.new(); local trigger1, trigger2, trigger3 = {}, {}, {}; local item1, item2, item3 = {}, {}, {}; |