[Tarantool-patches] [PATCH 08/19] Fix luacheck warnings in test/long_run-py
sergeyb at tarantool.org
sergeyb at tarantool.org
Thu Jul 16 17:11:34 MSK 2020
From: Sergey Bronnikov <sergeyb at tarantool.org>
Part of #4681
Reviewed-by: Vladislav Shpilevoy <v.shpilevoy at tarantool.org>
Reviewed-by: Igor Munkin <imun at tarantool.org>
Co-authored-by: Vladislav Shpilevoy <v.shpilevoy at tarantool.org>
Co-authored-by: Igor Munkin <imun at tarantool.org>
---
.luacheckrc | 7 ++++++-
test/long_run-py/lua/finalizers.lua | 7 +++----
test/long_run-py/suite.lua | 7 ++-----
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/.luacheckrc b/.luacheckrc
index c7854659c..84793362b 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -43,7 +43,6 @@ exclude_files = {
"test/box/lua/test_init.lua",
"test/engine/*.test.lua",
"test/engine_long/*.test.lua",
- "test/long_run-py/**/*.lua",
"test/replication/**/*.lua",
"test/replication-py/**/*.lua",
"test/sql-tap/**/*.lua",
@@ -169,3 +168,9 @@ files["test/engine_long/suite.lua"] = {
"delete_insert",
}
}
+files["test/long_run-py/suite.lua"] = {
+ globals = {
+ "delete_replace_update",
+ "delete_insert",
+ }
+}
diff --git a/test/long_run-py/lua/finalizers.lua b/test/long_run-py/lua/finalizers.lua
index 69146a323..4e57ebfa6 100644
--- a/test/long_run-py/lua/finalizers.lua
+++ b/test/long_run-py/lua/finalizers.lua
@@ -1,17 +1,16 @@
#!/usr/bin/env tarantool
-function on_gc(t)
+local function on_gc()
end;
-function test_finalizers()
- local result = {}
+local function test_finalizers()
+ local result = {} -- luacheck: no unused
local i = 1
local ffi = require('ffi')
while true do
result[i] = ffi.gc(ffi.cast('void *', 0), on_gc)
i = i + 1
end
- return "done"
end;
test_finalizers()
diff --git a/test/long_run-py/suite.lua b/test/long_run-py/suite.lua
index 0b33dec7d..6fe706366 100644
--- a/test/long_run-py/suite.lua
+++ b/test/long_run-py/suite.lua
@@ -1,9 +1,9 @@
-function string_function()
+local function string_function()
local random_number
local random_string
random_string = ""
- for x = 1,20,1 do
+ for _ = 1,20,1 do
random_number = math.random(65, 90)
random_string = random_string .. string.char(random_number)
end
@@ -11,7 +11,6 @@ function string_function()
end
function delete_replace_update(engine_name)
- local string_value
if (box.space._space.index.name:select{'tester'}[1] ~= nil) then
box.space.tester:drop()
end
@@ -41,7 +40,6 @@ function delete_replace_update(engine_name)
random_number = math.random(1,6)
string_value_3 = string_function()
--- print('<'..counter..'> [' .. random_number .. '] value_2: ' .. string_value_2 .. ' value_3: ' .. string_value_3)
if random_number == 1 then
box.space.tester:delete{string_value_2}
end
@@ -72,7 +70,6 @@ function delete_replace_update(engine_name)
end
function delete_insert(engine_name)
- local string_value
if (box.space._space.index.name:select{'tester'}[1] ~= nil) then
box.space.tester:drop()
end
--
2.26.2
More information about the Tarantool-patches
mailing list