From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Sergey Bronnikov <sergeyb@tarantool.org>, tarantool-patches@dev.tarantool.org, lvasiliev@tarantool.org Subject: Re: [Tarantool-patches] [PATCH 1/3] luacheck: fix warnings in test/box Date: Wed, 13 Jan 2021 17:38:16 +0100 [thread overview] Message-ID: <ef5511e5-59a4-e3ef-b3d3-fb32711a346f@tarantool.org> (raw) In-Reply-To: <24c86655-d972-ff0c-feef-a42f2bb16dfb@tarantool.org> 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; };
next prev parent reply other threads:[~2021-01-13 16:38 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-22 14:54 [Tarantool-patches] [PATCH v7 0/3] Fix luacheck warnings in test/box-tap, test/box and test/box-py sergeyb 2020-12-22 14:54 ` [Tarantool-patches] [PATCH 1/3] luacheck: fix warnings in test/box sergeyb 2021-01-11 17:52 ` Vladislav Shpilevoy via Tarantool-patches 2021-01-12 15:26 ` Sergey Bronnikov via Tarantool-patches 2021-01-13 7:58 ` Sergey Bronnikov via Tarantool-patches 2021-01-13 16:38 ` Vladislav Shpilevoy via Tarantool-patches [this message] 2021-01-14 7:49 ` Sergey Bronnikov via Tarantool-patches 2020-12-22 14:54 ` [Tarantool-patches] [PATCH v7 2/3] luacheck: fix warnings in test/box-py sergeyb 2020-12-22 14:54 ` [Tarantool-patches] [PATCH v7 3/3] luacheck: fix warnings in test/box-tap sergeyb 2021-01-11 17:52 ` Vladislav Shpilevoy via Tarantool-patches 2021-01-12 13:59 ` Sergey Bronnikov via Tarantool-patches 2021-01-12 14:52 ` Vladislav Shpilevoy via Tarantool-patches 2021-01-12 15:21 ` Sergey Bronnikov via Tarantool-patches 2020-12-25 10:37 ` [Tarantool-patches] [PATCH v7 0/3] Fix luacheck warnings in test/box-tap, test/box and test/box-py Kirill Yukhin 2020-12-30 10:17 ` Kirill Yukhin 2020-12-30 12:27 ` Leonid Vasiliev 2021-01-14 21:34 ` Vladislav Shpilevoy via Tarantool-patches 2021-01-15 9:48 ` Kirill Yukhin via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=ef5511e5-59a4-e3ef-b3d3-fb32711a346f@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=lvasiliev@tarantool.org \ --cc=sergeyb@tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 1/3] luacheck: fix warnings in test/box' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox