Skip to content

Commit 5dfd597

Browse files
committed
Add support for redis built-ins
1 parent cc089e3 commit 5dfd597

File tree

4 files changed

+102
-0
lines changed

4 files changed

+102
-0
lines changed

src/luacheck/builtin_standards/init.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ local love = require "luacheck.builtin_standards.love"
22
local minetest = require "luacheck.builtin_standards.minetest"
33
local playdate = require "luacheck.builtin_standards.playdate"
44
local ngx = require "luacheck.builtin_standards.ngx"
5+
local redis5 = require "luacheck.builtin_standards.redis5"
6+
local redis6 = require "luacheck.builtin_standards.redis6"
7+
local redis7 = require "luacheck.builtin_standards.redis7"
58
local standards = require "luacheck.standards"
69

710
local builtin_standards = {}
@@ -264,6 +267,9 @@ lua_defs.luajit = add_defs(make_min_def("luajit"), {
264267
})
265268
lua_defs.ngx_lua = add_defs(lua_defs.luajit, ngx)
266269
lua_defs.max = add_defs(lua_defs.lua51c, lua_defs.lua52c, lua_defs.lua53c, lua_defs.lua54c, lua_defs.luajit)
270+
lua_defs.redis5 = add_defs(lua_defs.lua51, redis5)
271+
lua_defs.redis6 = add_defs(lua_defs.redis5, redis6)
272+
lua_defs.redis7 = add_defs(lua_defs.redis6, redis7)
267273

268274
for name, def in pairs(lua_defs) do
269275
builtin_standards[name] = def_to_std(def)
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
local empty = {}
2+
3+
local redis = {
4+
fields = {
5+
ARGV = {
6+
other_fields = true,
7+
},
8+
KEYS = {
9+
other_fields = true,
10+
},
11+
12+
redis = {
13+
fields = {
14+
call = empty,
15+
pcall = empty,
16+
error_reply = empty,
17+
status_reply = empty,
18+
sha1hex = empty,
19+
log = empty,
20+
set_repl = empty,
21+
replicate_commands = empty,
22+
breakpoint = empty,
23+
debug = empty,
24+
},
25+
},
26+
27+
cjson = {
28+
fields = {
29+
decode = empty,
30+
encode = empty,
31+
},
32+
},
33+
34+
struct = {
35+
fields = {
36+
pack = empty,
37+
unpack = empty,
38+
size = empty,
39+
}
40+
},
41+
42+
cmsgpack = {
43+
fields = {
44+
pack = empty,
45+
unpack = empty,
46+
}
47+
},
48+
49+
bit = {
50+
fields = {
51+
tobit = empty,
52+
tohex = empty,
53+
bnot = empty,
54+
bor = empty,
55+
band = empty,
56+
bxor = empty,
57+
lshift = empty,
58+
rshift = empty,
59+
arshift = empty,
60+
rol = empty,
61+
ror = empty,
62+
bswap = empty,
63+
}
64+
}
65+
}
66+
}
67+
68+
return redis
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
local empty = {}
2+
3+
local redis = {
4+
fields = {
5+
redis = {
6+
fields = {
7+
setresp = empty,
8+
}
9+
10+
}
11+
}
12+
}
13+
14+
return redis
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
local empty = {}
2+
3+
local redis = {
4+
fields = {
5+
redis = {
6+
REDIS_VERSION = {},
7+
REDIS_VERSION_NUM = {},
8+
acl_check_cmd = empty,
9+
register_function = empty,
10+
}
11+
}
12+
}
13+
14+
return redis

0 commit comments

Comments
 (0)