Changeset

2356:49a01b78b45f

mod_storage_muc_log: Address luacheck warnings
author Kim Alvefur <zash@zash.se>
date Wed, 09 Nov 2016 13:37:58 +0100
parents 2355:513332854531
children 2357:093b70378fa5
files mod_storage_muc_log/mod_storage_muc_log.lua
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mod_storage_muc_log/mod_storage_muc_log.lua	Tue Nov 08 00:16:39 2016 +0100
+++ b/mod_storage_muc_log/mod_storage_muc_log.lua	Wed Nov 09 13:37:58 2016 +0100
@@ -1,3 +1,4 @@
+-- luacheck: ignore 212/self 431/err
 
 local datamanager = require"core.storagemanager".olddm;
 local xml_parse = require"util.xml".parse;
@@ -48,7 +49,9 @@
 	return with and tag.name .. "<" .. with or tag.name;
 end
 
-function driver:append(node, key, stanza, when, with)
+function driver:append(node, key, stanza, when, with) -- luacheck: ignore 212/key
+	-- luacheck: ignore 311/with
+	-- 'with' doesn't exist in the original mod_muc_log, so gets derived here
 	if type(when) ~= "number" then
 		when, with, stanza = stanza, when, with;
 	end
@@ -83,8 +86,6 @@
 	table.sort(dates);
 
 	return coroutine.wrap(function ()
-		local query = query;
-		local dates = dates;
 		local start_date = query and query.start and os_date(datef, query.start) or dates[1];
 		local end_date = query and query["end"] and os_date(datef, query["end"]) or dates[#dates];
 		local start_time = query and query.start and os_date(timef, query.start) or dates[1];
@@ -120,8 +121,8 @@
 						inner_start = inner_start + (query and query.reverse and -1 or 1);
 						seek_once = nil;
 					end
-					for i = inner_start, inner_stop, inner_step do
-						item, err = data[i];
+					for i = inner_start, inner_stop, inner_step do -- luacheck: ignore 423/i
+						item, err = data[i], nil;
 						if item then
 							item, err = xml_parse(item);
 						end