diff --git a/docsrc/cli.rst b/docsrc/cli.rst
index be222004..923b59da 100644
--- a/docsrc/cli.rst
+++ b/docsrc/cli.rst
@@ -88,7 +88,13 @@ Option Meaning
* ``luacheckrc`` - globals allowed in Luacheck configs, by default added for files ending with ``.luacheckrc``;
* ``ldoc`` - globals allowed in LDoc config, by default added for files named ``config.ld``;
* ``sile`` - globals allowed in The SILE Typesetter and its package ecosystem;
+ * ``redis5`` - globals available in `redis lua ` v5, including standard Lua 5.1 globals;
+ * ``redis6`` - globals available in redis lua v6, including standard Lua 5.1 globals;
+ * ``redis7`` - globals available in redis lua v7, including standard Lua 5.1 globals;
+ * ``redis_scripting`` - globals added by redis scripting;
+ * ``redis_functions`` - globals added by redis functions;
* ``none`` - no standard globals.
+
See :ref:`stds`
``--globals [] ...`` Add custom global variables or fields on top of standard ones. See :ref:`fields`
diff --git a/luacheck-dev-1.rockspec b/luacheck-dev-1.rockspec
index 0389dd14..deb1a7fc 100644
--- a/luacheck-dev-1.rockspec
+++ b/luacheck-dev-1.rockspec
@@ -48,6 +48,9 @@ build = {
["luacheck.builtin_standards.minetest"] = "src/luacheck/builtin_standards/minetest.lua",
["luacheck.builtin_standards.playdate"] = "src/luacheck/builtin_standards/playdate.lua",
["luacheck.builtin_standards.ngx"] = "src/luacheck/builtin_standards/ngx.lua",
+ ["luacheck.builtin_standards.redis5"] = "src/luacheck/builtin_standards/redis5.lua",
+ ["luacheck.builtin_standards.redis6"] = "src/luacheck/builtin_standards/redis6.lua",
+ ["luacheck.builtin_standards.redis7"] = "src/luacheck/builtin_standards/redis7.lua",
["luacheck.cache"] = "src/luacheck/cache.lua",
["luacheck.check"] = "src/luacheck/check.lua",
["luacheck.check_state"] = "src/luacheck/check_state.lua",
diff --git a/src/luacheck/builtin_standards/init.lua b/src/luacheck/builtin_standards/init.lua
index 097fee2d..98cefa3a 100644
--- a/src/luacheck/builtin_standards/init.lua
+++ b/src/luacheck/builtin_standards/init.lua
@@ -2,6 +2,11 @@ local love = require "luacheck.builtin_standards.love"
local minetest = require "luacheck.builtin_standards.minetest"
local playdate = require "luacheck.builtin_standards.playdate"
local ngx = require "luacheck.builtin_standards.ngx"
+local redis5 = require "luacheck.builtin_standards.redis5"
+local redis6 = require "luacheck.builtin_standards.redis6"
+local redis7 = require "luacheck.builtin_standards.redis7"
+local redis_scripts = require "luacheck.builtin_standards.redis_scripts"
+local redis_functions = require "luacheck.builtin_standards.redis_functions"
local standards = require "luacheck.standards"
local builtin_standards = {}
@@ -264,6 +269,11 @@ lua_defs.luajit = add_defs(make_min_def("luajit"), {
})
lua_defs.ngx_lua = add_defs(lua_defs.luajit, ngx)
lua_defs.max = add_defs(lua_defs.lua51c, lua_defs.lua52c, lua_defs.lua53c, lua_defs.lua54c, lua_defs.luajit)
+lua_defs.redis5 = add_defs(lua_defs.lua51, redis5)
+lua_defs.redis6 = add_defs(lua_defs.redis5, redis6)
+lua_defs.redis7 = add_defs(lua_defs.redis6, redis7)
+lua_defs.redis_scripts = redis_scripts
+lua_defs.redis_functions = redis_functions
for name, def in pairs(lua_defs) do
builtin_standards[name] = def_to_std(def)
diff --git a/src/luacheck/builtin_standards/redis5.lua b/src/luacheck/builtin_standards/redis5.lua
new file mode 100644
index 00000000..f8e16ad5
--- /dev/null
+++ b/src/luacheck/builtin_standards/redis5.lua
@@ -0,0 +1,59 @@
+local empty = {}
+
+local redis = {
+ fields = {
+ redis = {
+ fields = {
+ call = empty,
+ pcall = empty,
+ error_reply = empty,
+ status_reply = empty,
+ sha1hex = empty,
+ log = empty,
+ set_repl = empty,
+ replicate_commands = empty,
+ },
+ },
+
+ cjson = {
+ fields = {
+ decode = empty,
+ encode = empty,
+ },
+ },
+
+ struct = {
+ fields = {
+ pack = empty,
+ unpack = empty,
+ size = empty,
+ }
+ },
+
+ cmsgpack = {
+ fields = {
+ pack = empty,
+ unpack = empty,
+ }
+ },
+
+ bit = {
+ fields = {
+ tobit = empty,
+ tohex = empty,
+ bnot = empty,
+ bor = empty,
+ band = empty,
+ bxor = empty,
+ lshift = empty,
+ rshift = empty,
+ arshift = empty,
+ rol = empty,
+ ror = empty,
+ bswap = empty,
+ }
+ }
+ }
+}
+
+return redis
diff --git a/src/luacheck/builtin_standards/redis6.lua b/src/luacheck/builtin_standards/redis6.lua
new file mode 100644
index 00000000..e145f1bb
--- /dev/null
+++ b/src/luacheck/builtin_standards/redis6.lua
@@ -0,0 +1,14 @@
+local empty = {}
+
+local redis = {
+ fields = {
+ redis = {
+ fields = {
+ setresp = empty,
+ }
+
+ }
+ }
+}
+
+return redis
diff --git a/src/luacheck/builtin_standards/redis7.lua b/src/luacheck/builtin_standards/redis7.lua
new file mode 100644
index 00000000..8b453530
--- /dev/null
+++ b/src/luacheck/builtin_standards/redis7.lua
@@ -0,0 +1,14 @@
+local empty = {}
+
+local redis = {
+ fields = {
+ redis = {
+ REDIS_VERSION = {},
+ REDIS_VERSION_NUM = {},
+ acl_check_cmd = empty,
+ register_function = empty,
+ }
+ }
+}
+
+return redis
diff --git a/src/luacheck/builtin_standards/redis_functions.lua b/src/luacheck/builtin_standards/redis_functions.lua
new file mode 100644
index 00000000..6aef9f1a
--- /dev/null
+++ b/src/luacheck/builtin_standards/redis_functions.lua
@@ -0,0 +1,13 @@
+local empty = {}
+
+local redis_functions = {
+ fields = {
+ redis = {
+ fields = {
+ register_function = empty,
+ },
+ }
+ }
+}
+
+return redis_functions
diff --git a/src/luacheck/builtin_standards/redis_scripts.lua b/src/luacheck/builtin_standards/redis_scripts.lua
new file mode 100644
index 00000000..3ba72a77
--- /dev/null
+++ b/src/luacheck/builtin_standards/redis_scripts.lua
@@ -0,0 +1,20 @@
+local empty = {}
+
+local redis_scripts = {
+ fields = {
+ ARGV = {
+ other_fields = true,
+ },
+ KEYS = {
+ other_fields = true,
+ },
+ redis = {
+ fields = {
+ breakpoint = empty,
+ debug = empty,
+ },
+ }
+ }
+}
+
+return redis_scripts