[Tarantool-patches] [PATCH 1/6] Fix luacheck warnings in src/lua/

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu Apr 16 00:46:58 MSK 2020


>> @@ -428,7 +428,7 @@ local public_methods = {
>>  }
>>  
>>  local module_mt = {
>> -    __serialize = function(s)
>> +    __serialize = function()
>>          return public_methods
>>      end,
>>      __index = public_methods
> 
> I see no reasons to leave other W212[unused argument self] occurences.
> Here is a diff:
> 
> ================================================================================
> 
> diff --git a/src/lua/crypto.lua b/src/lua/crypto.lua
> index c0eb0d303..6a7ee53f0 100644
> --- a/src/lua/crypto.lua
> +++ b/src/lua/crypto.lua
> @@ -318,7 +318,7 @@ for class, digest in pairs(digests) do
>      digest_api[class] = setmetatable({
>          new = function () return digest_new(digest) end
>      }, {
> -        __call = function (self, str)
> +        __call = function (_, str)

I would better avoid such changes. They make it harder to understand
what the function takes as arguments. Luacheck in these cases basically
dictates to us how to name variables, because nothing is removed here.
The variable is just renamed to a less understandable name.


More information about the Tarantool-patches mailing list