From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 25C1A4C885; Tue, 12 Jan 2021 17:52:32 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 25C1A4C885 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1610463152; bh=b60VcOCHDJcMyeKwEcko7vmswIEv9haFimcofFOYKUk=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=LH6d8gv78RWKasNwGu22ImCVuxuVBNfUZJORocMhXzPD0Bf0OPOwTinqrrFz5Wlu1 XBbFGiczEUIZpUCPDsoR/ijaZD7NMk+q92s+oBQ/mUTzKb4im8oi3z57IN5IZ7gY8P bbilVMqOUzeKNLMwQhxREXcx/CNidJy2QFR0hQEQ= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id AEE244C885 for ; Tue, 12 Jan 2021 17:52:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AEE244C885 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1kzL25-0007Su-BV; Tue, 12 Jan 2021 17:52:29 +0300 To: Sergey Bronnikov , tarantool-patches@dev.tarantool.org, lvasiliev@tarantool.org References: <4f8d3525-ad8d-5c2a-429d-b87dc8ceb443@tarantool.org> <7fd3e42f-047b-e404-f481-689eb73acb8b@tarantool.org> Message-ID: Date: Tue, 12 Jan 2021 15:52:28 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <7fd3e42f-047b-e404-f481-689eb73acb8b@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9D0E79FBC973162CDDA1A336500443B3AD46BC604C28ED16A00894C459B0CD1B94C4D79D6A1F6B17AD1B1B19B3E10267FE13521B58003ADDEF65AAC9D8C52D1E3 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BB17EE3498E810FEEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063715F166F2542EEE4C8638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FCE681CCE15D286DCB351FDFBF1506A2B4F6E53E6DCD939DBF389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0998E19D2343267C68941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6D082881546D93491CC7F00164DA146DA6F5DAA56C3B73B23C77107234E2CFBA567F23339F89546C55F5C1EE8F4F765FC426E46268278306375ECD9A6C639B01BBD4B6F7A4D31EC0BC0CAF46E325F83A522CA9DD8327EE4931B544F03EFBC4D57F3CCD8A865B74A75C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0FECB2555BB02FD5A93B503F486389A921A5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A5BF3B6AC9A4D5DBF2FE7E496A148329ECD7DF56F64535CD71D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75448CF9D3A7B2C848410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D344F2126FF337FA651E116588E5DE0704B0A60424BE2CCB034DE8880C93E2E6DD65A789EB076B7ADCF1D7E09C32AA3244C7C021B0BC1CE5F3E12BE28D16BFA8EADF2F5F14F68F1805BFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojKc4NKhtl7uEB/qidJK5RFQ== X-Mailru-Sender: 689FA8AB762F73937240DDB2502DDB70BB7CFD6D31C82AC763A6E4C404180C233841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v7 3/3] luacheck: fix warnings in test/box-tap X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On 12.01.2021 14:59, Sergey Bronnikov wrote: > Thanks for review! > > On 11.01.2021 20:52, Vladislav Shpilevoy wrote: >> Thanks for the patch! >> >>> diff --git a/.luacheckrc b/.luacheckrc >>> index 52625bb35..b7f9abb45 100644 >>> --- a/.luacheckrc >>> +++ b/.luacheckrc >>> @@ -157,3 +156,23 @@ files["test/box/lua/fifo.lua"] = { >>>   files["test/box/lua/identifier.lua"] = { >>>        globals = {"run_test"} >>>   } >>> +files["test/box-tap/session.test.lua"] = { >>> +    globals = { >>> +        "active_connections", >> This can be declared 'local'. > > and with removed a single suppression in .luacheckrc we have got another warnings, > > that should be suppressed too (inline or in luacheckrc): > > Checking test/box-tap/session.test.lua            4 warnings > >     test/box-tap/session.test.lua:73:22: setting non-standard global variable active_connections >     test/box-tap/session.test.lua:73:43: accessing undefined variable active_connections >     test/box-tap/session.test.lua:74:22: setting non-standard global variable active_connections >     test/box-tap/session.test.lua:74:43: accessing undefined variable active_connections > > I think it is better to keep it as is. It seems you didn't bother with applying my diff from the previous email, did you? I kept it below: >> ==================== >> @@ -70,6 +70,7 @@ session.on_disconnect(nil, fail) >>     -- check how connect/disconnect triggers work >>   local peer_name = "peer_name" >> +local active_connections = 0 >>   local function inc() active_connections = active_connections + 1 end >>   local function dec() active_connections = active_connections - 1 end >>   local function peer() peer_name = box.session.peer() end >> @@ -77,7 +78,6 @@ local net = { box = require('net.box') } >>   test:is(type(session.on_connect(inc)), "function", "type of trigger inc on_connect") >>   test:is(type(session.on_disconnect(dec)), "function", "type of trigger dec on_disconnect") >>   test:is(type(session.on_disconnect(peer)), "function", "type of trigger peer on_disconnect") >> -active_connections = 0 >>   local c = net.box.connect(HOST, PORT) >> ==================== I will paste here the full diff now, with the line removed from .luacheck: ==================== diff --git a/.luacheckrc b/.luacheckrc index b7f9abb45..6043722f4 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -158,7 +158,6 @@ files["test/box/lua/identifier.lua"] = { } files["test/box-tap/session.test.lua"] = { globals = { - "active_connections", "session", "space", "f1", diff --git a/test/box-tap/session.test.lua b/test/box-tap/session.test.lua index 160f047bc..3dd159ebb 100755 --- a/test/box-tap/session.test.lua +++ b/test/box-tap/session.test.lua @@ -70,6 +70,7 @@ session.on_disconnect(nil, fail) -- check how connect/disconnect triggers work local peer_name = "peer_name" +local active_connections = 0 local function inc() active_connections = active_connections + 1 end local function dec() active_connections = active_connections - 1 end local function peer() peer_name = box.session.peer() end @@ -77,7 +78,6 @@ local net = { box = require('net.box') } test:is(type(session.on_connect(inc)), "function", "type of trigger inc on_connect") test:is(type(session.on_disconnect(dec)), "function", "type of trigger dec on_disconnect") test:is(type(session.on_disconnect(peer)), "function", "type of trigger peer on_disconnect") -active_connections = 0 local c = net.box.connect(HOST, PORT) ==================== You can copy-paste it into a file and use `git apply` to repeat it exactly. From the errors you have shown above it looks like you didn't move the declaration above its usages (I tried it and got the same errors, of course). You just added 'local', and didn't try to move it. With this diff I run luacheck command and get 0 errors/warnings. ==================== $ ./.rocks/bin/luacheck --codes --config .luacheckrc test/box-tap/session.test.lua Checking test/box-tap/session.test.lua OK Total: 0 warnings / 0 errors in 1 file ====================