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 1AEF764672; Wed, 13 Jan 2021 19:38:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1AEF764672 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1610555900; bh=kEBWnoAar7ilICPqtkSmP5WfDmtSw/jZh0uf+zdfI5o=; 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=HBDf/tu93WUTw2N92Tb9acu++wW7V7ASg4HvZtuX7Qg2+47AuT8KY5EGG0ldWn6Yy m9MfWOPwy/3zxJg20vURV2sTEq+NzbQIROcJf9RWpq64yJnfQKKkOSvI42Ef7SyelD fzFP8ATAcUhX9ukR1uR/tzhXFgN4nQz9BOYu85fw= 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 271FF64672 for ; Wed, 13 Jan 2021 19:38:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 271FF64672 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1kzjA2-0004rE-25; Wed, 13 Jan 2021 19:38:18 +0300 To: Sergey Bronnikov , tarantool-patches@dev.tarantool.org, lvasiliev@tarantool.org References: <08266e7e73c778c80dd9954b4e45fe1d5cfa9b21.1608647958.git.estetus@gmail.com> <63ceba2d-9aa3-84db-9d56-7d15a2053167@tarantool.org> <24c86655-d972-ff0c-feef-a42f2bb16dfb@tarantool.org> Message-ID: Date: Wed, 13 Jan 2021 17:38:16 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <24c86655-d972-ff0c-feef-a42f2bb16dfb@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D0E79FBC973162CDAC53986DC5FB1AB1465E8C05863AF8B800894C459B0CD1B972301752885E13801EB3712F7E79BE8A819B40F00148620D94981B86E6AE2D10 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE78EB5DF72B5A7B6ADEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637DC5FF0CF1FFF13268638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC51A6DB544064DD45D95A1262C993532B50DFBE6D19094425389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0C26CFBAC0749D213D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8B5FC25ED3FCEC3375A471835C12D1D977C4224003CC836476EC64975D915A344093EC92FD9297F6718AA50765F7900637553F28B1F14F2446A7F4EDE966BC389F395957E7521B51C24C7702A67D5C33162DBA43225CD8A89FF841BD135A60A317262FEC7FBD7D1F5BB5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DBAF038BB36E94EA6B574AF45C6390F7469DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A55B2CC583221941F190D3D3A5698B38699B74DAA417A2A1B9D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA758F9E841AEAEC4F2C410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D345CB6DE26F16546677F6705575532244FABBA985429E07CCA87347DE94AC27B0FE4D7A868F0F9E9191D7E09C32AA3244CE8661CDB536AD21EE95B345A4675B8EC05AB220A9D022EBCFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj4exXbGs3yZp7LKM3Pv3MIg== X-Mailru-Sender: 689FA8AB762F73937240DDB2502DDB70745C2D55C172C9B6922535A2D749C9203841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 1/3] luacheck: fix warnings in test/box 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" Hi! Thanks for the fixes! Consider my fixes on top of this commit on the branch, and below with explanations. ================================================== diff --git a/.luacheckrc b/.luacheckrc index 749574378..0ff90450e 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -115,8 +115,3 @@ files["test/box/box.lua"] = { "iproto_request", } } -files["test/box/lua/bitset.lua"] = { - globals = { - "dump", - } -} ==================== You don't need to ignore it, because it works fine when declared 'local'. It does not prevent its usage inside of the module, because local or not, it is still 'global' inside the file. The only problem was in the test, where it was also saved to a local variable. Which won't work in non-tap tests, because each line here is executed as a script. It means, 'local' variables are not visible out of the line where they are declared. I removed 'local' from the test file, and it allowed not to ignore anything in bitset.lua. ==================== diff --git a/test/box/bitset.result b/test/box/bitset.result index 3296f66d8..af3384d3f 100644 --- a/test/box/bitset.result +++ b/test/box/bitset.result @@ -1,7 +1,7 @@ bset = require('bitset') --- ... -local dump = bset.dump +dump = bset.dump --- ... bset.create_space() diff --git a/test/box/bitset.test.lua b/test/box/bitset.test.lua index c56a7e1a4..cb7c408f5 100644 --- a/test/box/bitset.test.lua +++ b/test/box/bitset.test.lua @@ -1,6 +1,6 @@ bset = require('bitset') -local dump = bset.dump +dump = bset.dump bset.create_space() ------------------------------------------------------------------------------ diff --git a/test/box/lua.result b/test/box/lua.result index 409ab7e8f..4c14f200d 100644 --- a/test/box/lua.result +++ b/test/box/lua.result @@ -625,46 +625,46 @@ space = box.schema.space.create('tweedledum') tmp = space:create_index('primary', { type = 'tree', parts = {1, 'unsigned'}, unique = true }) --- ... -push = require('push') +push_collection = require('push') ==================== This allowed to revert some big diff from your changes. Everything below turns into no-diff when squashed into your commit. ==================== --- ... -push.push_collection(space, 0, 1038784, 'hello') +push_collection(space, 0, 1038784, 'hello') --- - [1038784, 'hello'] ... -push.push_collection(space, 0, 1038784, 'hello') +push_collection(space, 0, 1038784, 'hello') --- - [1038784] ... -push.push_collection(space, 0, 1038784, 'hello') +push_collection(space, 0, 1038784, 'hello') --- - [1038784] ... -push.push_collection(space, 1, 1038784, 'hi') +push_collection(space, 1, 1038784, 'hi') --- - [1038784, 'hi'] ... -push.push_collection(space, 2, 1038784, 'hi') +push_collection(space, 2, 1038784, 'hi') --- - [1038784, 'hi', 'hi'] ... -push.push_collection(space, 2, 1038784, 'hi') +push_collection(space, 2, 1038784, 'hi') --- - [1038784, 'hi', 'hi'] ... -push.push_collection(space, 5, 1038784, 'hey') +push_collection(space, 5, 1038784, 'hey') --- - [1038784, 'hi', 'hi', 'hey'] ... -push.push_collection(space, 5, 1038784, 'hey') +push_collection(space, 5, 1038784, 'hey') --- - [1038784, 'hi', 'hi', 'hey', 'hey'] ... -push.push_collection(space, 5, 1038784, 'hey') +push_collection(space, 5, 1038784, 'hey') --- - [1038784, 'hi', 'hi', 'hey', 'hey', 'hey'] ... -push.push_collection(space, 5, 1038784, 'hey') +push_collection(space, 5, 1038784, 'hey') --- - [1038784, 'hi', 'hey', 'hey', 'hey', 'hey'] ... @@ -752,7 +752,7 @@ space:drop() -- -- index:random test -- -test = require('index_random_test') +index_random_test = require('index_random_test') --- ... space = box.schema.space.create('tweedledum') @@ -767,14 +767,14 @@ tmp = space:create_index('secondary', { type = 'hash', parts = {1, 'unsigned'}, ------------------------------------------------------------------------------- -- TreeIndex::random() ------------------------------------------------------------------------------- -test.index_random_test(space, 'primary') +index_random_test(space, 'primary') --- - true ... ------------------------------------------------------------------------------- -- HashIndex::random() ------------------------------------------------------------------------------- -test.index_random_test(space, 'secondary') +index_random_test(space, 'secondary') --- - true ... diff --git a/test/box/lua.test.lua b/test/box/lua.test.lua index 8d429a7e3..9762e07eb 100644 --- a/test/box/lua.test.lua +++ b/test/box/lua.test.lua @@ -225,20 +225,20 @@ space:drop() space = box.schema.space.create('tweedledum') tmp = space:create_index('primary', { type = 'tree', parts = {1, 'unsigned'}, unique = true }) -push = require('push') +push_collection = require('push') -push.push_collection(space, 0, 1038784, 'hello') -push.push_collection(space, 0, 1038784, 'hello') -push.push_collection(space, 0, 1038784, 'hello') +push_collection(space, 0, 1038784, 'hello') +push_collection(space, 0, 1038784, 'hello') +push_collection(space, 0, 1038784, 'hello') -push.push_collection(space, 1, 1038784, 'hi') -push.push_collection(space, 2, 1038784, 'hi') -push.push_collection(space, 2, 1038784, 'hi') +push_collection(space, 1, 1038784, 'hi') +push_collection(space, 2, 1038784, 'hi') +push_collection(space, 2, 1038784, 'hi') -push.push_collection(space, 5, 1038784, 'hey') -push.push_collection(space, 5, 1038784, 'hey') -push.push_collection(space, 5, 1038784, 'hey') -push.push_collection(space, 5, 1038784, 'hey') +push_collection(space, 5, 1038784, 'hey') +push_collection(space, 5, 1038784, 'hey') +push_collection(space, 5, 1038784, 'hey') +push_collection(space, 5, 1038784, 'hey') -- # lua box.auto_increment() testing -- # http://bugs.launchpad.net/tarantool/+bug/1006354 @@ -277,7 +277,7 @@ space:drop() -- -- index:random test -- -test = require('index_random_test') +index_random_test = require('index_random_test') space = box.schema.space.create('tweedledum') tmp = space:create_index('primary', { type = 'tree', parts = {1, 'unsigned'}, unique = true }) tmp = space:create_index('secondary', { type = 'hash', parts = {1, 'unsigned'}, unique = true }) @@ -285,13 +285,13 @@ tmp = space:create_index('secondary', { type = 'hash', parts = {1, 'unsigned'}, -- TreeIndex::random() ------------------------------------------------------------------------------- -test.index_random_test(space, 'primary') +index_random_test(space, 'primary') ------------------------------------------------------------------------------- -- HashIndex::random() ------------------------------------------------------------------------------- -test.index_random_test(space, 'secondary') +index_random_test(space, 'secondary') space:drop() space = nil diff --git a/test/box/lua/bitset.lua b/test/box/lua/bitset.lua index 3420727cf..245e9f097 100644 --- a/test/box/lua/bitset.lua +++ b/test/box/lua/bitset.lua @@ -32,7 +32,7 @@ local function drop_space() box.space['tweedledum']:drop() end -function dump(...) +local function dump(...) return utils.iterate('tweedledum', 'bitset', 1, 2, ...) end @@ -50,11 +50,11 @@ local function test_insert_delete(n) end return { - clear = clear; - create_space = create_space; - delete = delete; - drop_space = drop_space; - dump = dump; - fill = fill; - test_insert_delete = test_insert_delete; + clear = clear, + create_space = create_space, + delete = delete, + drop_space = drop_space, + dump = dump, + fill = fill, + test_insert_delete = test_insert_delete, ==================== We don't use ';' anywhere. It may still be used in some old code, but not in the new code. I have no idea though if it is stated anywhere formally. ==================== } diff --git a/test/box/lua/fifo.lua b/test/box/lua/fifo.lua index 9003904e2..3288c8be8 100644 --- a/test/box/lua/fifo.lua +++ b/test/box/lua/fifo.lua @@ -32,8 +32,8 @@ local function fifo_top(space, name) end return { - find_or_create_fifo = find_or_create_fifo; - fifo_push = fifo_push; - fifo_top = fifo_top; - fifomax = fifomax; + find_or_create_fifo = find_or_create_fifo, + fifo_push = fifo_push, + fifo_top = fifo_top, + fifomax = fifomax, }; diff --git a/test/box/lua/index_random_test.lua b/test/box/lua/index_random_test.lua index b6248c07c..d8622a4db 100644 --- a/test/box/lua/index_random_test.lua +++ b/test/box/lua/index_random_test.lua @@ -40,6 +40,4 @@ local function index_random_test(space, index_no) return true end -return { - index_random_test = index_random_test; -} +return index_random_test diff --git a/test/box/lua/push.lua b/test/box/lua/push.lua index 7c9b36275..5ce0c12bc 100644 --- a/test/box/lua/push.lua +++ b/test/box/lua/push.lua @@ -1,4 +1,3 @@ - local function push_collection(space, size, cid, ...) local append = { ... } local tuple = space:get{cid} @@ -15,6 +14,4 @@ local function push_collection(space, size, cid, ...) return space:replace{tuple:unpack()} end -return { - push_collection = push_collection; -} +return push_collection diff --git a/test/box/lua/utils.lua b/test/box/lua/utils.lua index 0eb427eb9..e6b3a6b57 100644 --- a/test/box/lua/utils.lua +++ b/test/box/lua/utils.lua @@ -209,11 +209,11 @@ end return { iterate = iterate; arithmetic = arithmetic; - create_iterator = create_iterator; - check_space = check_space; table_generate = table_generate; table_shuffle = table_shuffle; sort = sort; + check_space = check_space; space_bsize = space_bsize; + create_iterator = create_iterator; ==================== In your patch you somewhy moved these 2 functions. I moved them back to reduce diff. ==================== setmap = setmap; };