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

Igor Munkin imun at tarantool.org
Thu Apr 16 16:52:56 MSK 2020


Vlad,

On 15.04.20, Vladislav Shpilevoy wrote:
> >> @@ -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.

Well, your point also sounds rational and I agree with you since code is
written for us not for luacheck. I guess we need investigate can we
suppress globally only unused args with the name <self> but still
reports others? Otherwise we can suppress it inline. Chunk-wide
suppression can lead to masked/false-negative errors.

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list