[Tarantool-patches] [PATCH 1/3] luacheck: fix warnings in test/box

Sergey Bronnikov sergeyb at tarantool.org
Tue Jan 12 18:26:33 MSK 2021


Thanks for review!

On 11.01.2021 20:52, Vladislav Shpilevoy wrote:
> Hi! Thanks for the patch!
>
> See 2 comments below.
>
>> diff --git a/.luacheckrc b/.luacheckrc
>> index 4b829f3dc..17cff8671 100644
>> --- a/.luacheckrc
>> +++ b/.luacheckrc
>> @@ -102,3 +108,53 @@ files["src/box/lua/console.lua"] = {
>>           "212",
>>       }
>>   }
>> +files["test/box/box.lua"] = {
>> +    globals = {
>> +        "cfg_filter",
>> +        "sorted",
>> +        "iproto_request",
>> +    }
>> +}
>> +files["test/box/lua/push.lua"] = {
>> +    globals = {"push_collection"}
>> +}
>> +files["test/box/lua/index_random_test.lua"] = {
>> +    globals = {"index_random_test"}
>> +}
>> +files["test/box/lua/utils.lua"] = {
>> +    globals = {
>> +        "arithmetic",
>> +        "check_space",
>> +        "create_iterator",
>> +        "iterate",
>> +        "setmap",
>> +        "sort",
>> +        "space_field_types",
>> +        "space_bsize",
>> +        "table_generate",
>> +        "table_shuffle",
>> +        "tuple_to_string",
> 1. All these functions are returned by the module. It means,
> they are supposed to be used like this:
>
> 	utils = require('utils.lua')
> 	utils.setmap()
> 	utils.space_bsize()
> 	-- etc
>
> This in turn means you need to make them all 'local' in utils.lua.
> I did it, and the tests pass. Also some of these functions are
> probably unused, but I didn't check.
>
> The same for identifier.lua below.

- removed some functions from interfaces and their implementations

- most lua libs converted to modules and removed suppressions removed 
from luacheckrc except

"dump" function. It is used in module itself and mark it as local is not 
enough to make luacheck happy.

I didn't post patch here because it is too huge. Let me know if you need 
new patch series, I'll resend it.

>> +    }
>> +}
>> +files["test/box/lua/bitset.lua"] = {
>> +    globals = {
>> +        "clear",
>> +        "create_space",
>> +        "delete",
>> +        "drop_space",
>> +        "dump",
>> +        "fill",
>> +        "test_insert_delete",
> 2. Almost the same here. With a difference that the functions
> are not returned now. But they are used in a single file, so their
> 'return' like in utils.lua does should be easy to do.
>
> The same for fifo.lua below.
converted to modules
>
>> +    }
>> +}
>> +files["test/box/lua/fifo.lua"] = {
>> +    globals = {
>> +        "fifomax",
>> +        "fifo_push",
>> +        "fifo_top",
>> +        "find_or_create_fifo",
>> +    }
>> +}
>> +files["test/box/lua/identifier.lua"] = {
>> +     globals = {"run_test"}
>> +}


More information about the Tarantool-patches mailing list