Changeset

9412:063977461363

mod_s2s: Silence all warnings instead of ignoring the entire module
author Kim Alvefur <zash@zash.se>
date Sun, 30 Sep 2018 17:49:56 +0200
parents 9411:62c876e333e4
children 9413:127208a6107c
files .luacheckrc plugins/mod_s2s/mod_s2s.lua
diffstat 2 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/.luacheckrc	Sun Sep 30 14:55:39 2018 +0200
+++ b/.luacheckrc	Sun Sep 30 17:49:56 2018 +0200
@@ -138,8 +138,6 @@
 	"plugins/mod_http_files.lua";
 	"plugins/mod_net_multiplex.lua";
 	"plugins/mod_privacy.lua";
-	"plugins/mod_s2s/mod_s2s.lua";
-	"plugins/mod_s2s/s2sout.lib.lua";
 	"plugins/mod_storage_sql1.lua";
 	"plugins/mod_storage_sql.lua";
 	"plugins/mod_websocket.lua";
--- a/plugins/mod_s2s/mod_s2s.lua	Sun Sep 30 14:55:39 2018 +0200
+++ b/plugins/mod_s2s/mod_s2s.lua	Sun Sep 30 17:49:56 2018 +0200
@@ -119,6 +119,7 @@
 			if host.sendq then
 				t_insert(host.sendq, queued_item);
 			else
+				-- luacheck: ignore 122
 				host.sendq = { queued_item };
 			end
 			host.log("debug", "stanza [%s] queued ", stanza.name);
@@ -175,7 +176,7 @@
 	module:hook("route/remote", route_to_new_session, -10);
 	module:hook("s2s-authenticated", make_authenticated, -1);
 	module:hook("s2s-read-timeout", keepalive, -1);
-	module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza)
+	module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) -- luacheck: ignore 212/stanza
 		if session.type == "s2sout" then
 			-- Stream is authenticated and we are seem to be done with feature negotiation,
 			-- so the stream is ready for stanzas.  RFC 6120 Section 4.3
@@ -497,10 +498,13 @@
 					if reason.extra then
 						stanza:add_child(reason.extra);
 					end
-					log("debug", "Disconnecting %s[%s], <stream:error> is: %s", session.host or session.ip or "(unknown host)", session.type, stanza);
+					log("debug", "Disconnecting %s[%s], <stream:error> is: %s",
+					session.host or session.ip or "(unknown host)", session.type, stanza);
 					session.sends2s(stanza);
 				elseif reason.name then -- a stanza
-					log("debug", "Disconnecting %s->%s[%s], <stream:error> is: %s", session.from_host or "(unknown host)", session.to_host or "(unknown host)", session.type, reason);
+					log("debug", "Disconnecting %s->%s[%s], <stream:error> is: %s",
+						session.from_host or "(unknown host)", session.to_host or "(unknown host)",
+						session.type, reason);
 					session.sends2s(reason);
 				end
 			end
@@ -509,8 +513,11 @@
 		session.sends2s("</stream:stream>");
 		function session.sends2s() return false; end
 
+		-- luacheck: ignore 422/reason
+		-- FIXME reason should be managed in a place common to c2s, s2s, bosh, component etc
 		local reason = remote_reason or (reason and (reason.text or reason.condition)) or reason;
-		session.log("info", "%s s2s stream %s->%s closed: %s", session.direction:gsub("^.", string.upper), session.from_host or "(unknown host)", session.to_host or "(unknown host)", reason or "stream closed");
+		session.log("info", "%s s2s stream %s->%s closed: %s", session.direction:gsub("^.", string.upper),
+			session.from_host or "(unknown host)", session.to_host or "(unknown host)", reason or "stream closed");
 
 		-- Authenticated incoming stream may still be sending us stanzas, so wait for </stream:stream> from remote
 		local conn = session.conn;
@@ -529,7 +536,7 @@
 	end
 end
 
-function session_stream_attrs(session, from, to, attr)
+function session_stream_attrs(session, from, to, attr) -- luacheck: ignore 212/session
 	if not from or (hosts[from] and hosts[from].modules.dialback) then
 		attr["xmlns:db"] = 'jabber:server:dialback';
 	end
@@ -597,7 +604,7 @@
 	session.close = session_close;
 
 	local handlestanza = stream_callbacks.handlestanza;
-	function session.dispatch_stanza(session, stanza)
+	function session.dispatch_stanza(session, stanza) -- luacheck: ignore 432/session
 		return handlestanza(session, stanza);
 	end