net.adns: Silence individual luacheck warnings instead of ignoring entire file
authorKim Alvefur <zash@zash.se>
Mon, 24 Dec 2018 03:00:27 +0100
changeset 9735 47121e8dc5b1
parent 9734 69ef22961b7d
child 9736 51583ea2b4fd
net.adns: Silence individual luacheck warnings instead of ignoring entire file
.luacheckrc
net/adns.lua
--- a/.luacheckrc	Sun Dec 23 15:34:19 2018 +0100
+++ b/.luacheckrc	Mon Dec 24 03:00:27 2018 +0100
@@ -132,7 +132,6 @@
 	"fallbacks/bit.lua";
 	"fallbacks/lxp.lua";
 
-	"net/adns.lua";
 	"net/cqueues.lua";
 	"net/dns.lua";
 	"net/server_select.lua";
--- a/net/adns.lua	Sun Dec 23 15:34:19 2018 +0100
+++ b/net/adns.lua	Mon Dec 24 03:00:27 2018 +0100
@@ -14,7 +14,7 @@
 local coroutine, tostring, pcall = coroutine, tostring, pcall;
 local setmetatable = setmetatable;
 
-local function dummy_send(sock, data, i, j) return (j-i)+1; end
+local function dummy_send(sock, data, i, j) return (j-i)+1; end -- luacheck: ignore 212
 
 local _ENV = nil;
 -- luacheck: std none
@@ -29,8 +29,7 @@
 	local peername = "<unknown>";
 	local listener = {};
 	local handler = {};
-	local err;
-	function listener.onincoming(conn, data)
+	function listener.onincoming(conn, data) -- luacheck: ignore 212/conn
 		if data then
 			resolver:feed(handler, data);
 		end
@@ -46,9 +45,12 @@
 			resolver:servfail(conn); -- Let the magic commence
 		end
 	end
-	handler, err = server.wrapclient(sock, "dns", 53, listener);
-	if not handler then
-		return nil, err;
+	do
+		local err;
+		handler, err = server.wrapclient(sock, "dns", 53, listener);
+		if not handler then
+			return nil, err;
+		end
 	end
 
 	handler.settimeout = function () end
@@ -89,7 +91,7 @@
 			end)(resolver:peek(qname, qtype, qclass));
 end
 
-function query_methods:cancel(call_handler, reason)
+function query_methods:cancel(call_handler, reason) -- luacheck: ignore 212/reason
 	log("warn", "Cancelling DNS lookup for %s", tostring(self[4]));
 	self[1].cancel(self[2], self[3], self[4], self[5], call_handler);
 end