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

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Jul 14 01:59:09 MSK 2020


Hi! Thanks for the fixes!

I've force pushed the following changes:

====================
diff --git a/src/lua/fio.lua b/src/lua/fio.lua
index b31311b7b..954c44cdf 100644
--- a/src/lua/fio.lua
+++ b/src/lua/fio.lua
@@ -378,7 +378,7 @@ fio.mktree = function(path, mode)
     end
     path = fio.abspath(path)
 
-    path = string.gsub(path, '^/', '')
+    local path = string.gsub(path, '^/', '')
====================

As I pointed out already, all kinds of redefinition warnings
were disabled. No need to touch them.

====================
     local dirs = string.split(path, "/")
 
     local current_dir = "/"
diff --git a/src/lua/init.lua b/src/lua/init.lua
index 280ecc03f..9e3c813c3 100644
--- a/src/lua/init.lua
+++ b/src/lua/init.lua
@@ -80,7 +80,7 @@ dostring = function(s, ...)
 end
 
 local fiber = require("fiber")
-local exit = function(code)
+local function exit(code)
====================

Easier to grep, and just looks more natural.

====================
     code = (type(code) == 'number') and code or 0
     ffi.C.tarantool_exit(code)
     -- Make sure we yield even if the code after
diff --git a/src/lua/log.lua b/src/lua/log.lua
index bf0e4283c..cfd83f592 100644
--- a/src/lua/log.lua
+++ b/src/lua/log.lua
@@ -459,7 +459,7 @@ local function reload_cfg(cfg)
 end
 
 -- Load or reload configuration via log.cfg({}) call.
-local function load_cfg(oldcf, cfg) -- luacheck: no unused args
+local function load_cfg(self, cfg)
====================

The function is a __call method of the configuration table.
So the first argument is always self. And it is legal to
rename it. Also this is preferable since we force 'self' as
a special name in our luacheck config.

====================
     cfg = cfg or {}
 
     -- log option might be zero length string, which


More information about the Tarantool-patches mailing list