diff --git a/apisix/plugins/prometheus/exporter.lua b/apisix/plugins/prometheus/exporter.lua index 06243f8ecca1..538deaba3a49 100644 --- a/apisix/plugins/prometheus/exporter.lua +++ b/apisix/plugins/prometheus/exporter.lua @@ -17,6 +17,7 @@ local base_prometheus = require("resty.prometheus") local core = require("apisix.core") local ipairs = ipairs +local ngx = ngx local ngx_capture = ngx.location.capture local re_gmatch = ngx.re.gmatch local prometheus diff --git a/apisix/plugins/zipkin/codec.lua b/apisix/plugins/zipkin/codec.lua index 1d888fbb9bc3..a6a273979aca 100644 --- a/apisix/plugins/zipkin/codec.lua +++ b/apisix/plugins/zipkin/codec.lua @@ -17,6 +17,10 @@ local core = require("apisix.core") local to_hex = require "resty.string".to_hex local new_span_context = require("opentracing.span_context").new +local ngx = ngx +local string = string +local pairs = pairs +local tonumber = tonumber local function hex_to_char(c) return string.char(tonumber(c, 16)) diff --git a/apisix/plugins/zipkin/random_sampler.lua b/apisix/plugins/zipkin/random_sampler.lua index 0a9290449f37..f2ee5b49a550 100644 --- a/apisix/plugins/zipkin/random_sampler.lua +++ b/apisix/plugins/zipkin/random_sampler.lua @@ -14,6 +14,12 @@ -- See the License for the specific language governing permissions and -- limitations under the License. -- +local assert = assert +local type = type +local setmetatable = setmetatable +local math = math + + local _M = {} local mt = { __index = _M } diff --git a/apisix/plugins/zipkin/reporter.lua b/apisix/plugins/zipkin/reporter.lua index 8d6b4c06b8af..cc71fc5c8cca 100644 --- a/apisix/plugins/zipkin/reporter.lua +++ b/apisix/plugins/zipkin/reporter.lua @@ -18,6 +18,11 @@ local resty_http = require "resty.http" local to_hex = require "resty.string".to_hex local cjson = require "cjson".new() cjson.encode_number_precision(16) +local assert = assert +local type = type +local setmetatable = setmetatable +local math = math +local tostring = tostring local _M = {} diff --git a/apisix/stream/plugins/mqtt-proxy.lua b/apisix/stream/plugins/mqtt-proxy.lua index 439eee285820..f8d3552c66c4 100644 --- a/apisix/stream/plugins/mqtt-proxy.lua +++ b/apisix/stream/plugins/mqtt-proxy.lua @@ -16,6 +16,8 @@ -- local core = require("apisix.core") local balancer = require("ngx.balancer") +local bit = require "bit" +local ngx = ngx local ngx_exit = ngx.exit local str_byte = string.byte local str_sub = string.sub diff --git a/utils/check-lua-code-style.sh b/utils/check-lua-code-style.sh index caee7b4472ab..6cb80d36e6d9 100755 --- a/utils/check-lua-code-style.sh +++ b/utils/check-lua-code-style.sh @@ -21,15 +21,7 @@ set -ex luacheck -q apisix -./utils/lj-releng \ - apisix/*.lua \ - apisix/admin/*.lua \ - apisix/core/*.lua \ - apisix/http/*.lua \ - apisix/http/router/*.lua \ - apisix/plugins/*.lua \ - apisix/plugins/grpc-transcode/*.lua \ - apisix/plugins/limit-count/*.lua > \ +find apisix -name '*.lua' -exec ./utils/lj-releng {} + > \ /tmp/check.log 2>&1 || (cat /tmp/check.log && exit 1) grep -E "ERROR.*.lua:" /tmp/check.log > /tmp/error.log | true