Skip to content

Commit 06acbe9

Browse files
authored
test: check lua code style in all Lua file under apisix/ (#1518)
1 parent a53b470 commit 06acbe9

File tree

6 files changed

+19
-9
lines changed

6 files changed

+19
-9
lines changed

apisix/plugins/prometheus/exporter.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
local base_prometheus = require("resty.prometheus")
1818
local core = require("apisix.core")
1919
local ipairs = ipairs
20+
local ngx = ngx
2021
local ngx_capture = ngx.location.capture
2122
local re_gmatch = ngx.re.gmatch
2223
local prometheus

apisix/plugins/zipkin/codec.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
local core = require("apisix.core")
1818
local to_hex = require "resty.string".to_hex
1919
local new_span_context = require("opentracing.span_context").new
20+
local ngx = ngx
21+
local string = string
22+
local pairs = pairs
23+
local tonumber = tonumber
2024

2125
local function hex_to_char(c)
2226
return string.char(tonumber(c, 16))

apisix/plugins/zipkin/random_sampler.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
-- See the License for the specific language governing permissions and
1515
-- limitations under the License.
1616
--
17+
local assert = assert
18+
local type = type
19+
local setmetatable = setmetatable
20+
local math = math
21+
22+
1723
local _M = {}
1824
local mt = { __index = _M }
1925

apisix/plugins/zipkin/reporter.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ local resty_http = require "resty.http"
1818
local to_hex = require "resty.string".to_hex
1919
local cjson = require "cjson".new()
2020
cjson.encode_number_precision(16)
21+
local assert = assert
22+
local type = type
23+
local setmetatable = setmetatable
24+
local math = math
25+
local tostring = tostring
2126

2227

2328
local _M = {}

apisix/stream/plugins/mqtt-proxy.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
--
1717
local core = require("apisix.core")
1818
local balancer = require("ngx.balancer")
19+
local bit = require "bit"
20+
local ngx = ngx
1921
local ngx_exit = ngx.exit
2022
local str_byte = string.byte
2123
local str_sub = string.sub

utils/check-lua-code-style.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,7 @@ set -ex
2121

2222
luacheck -q apisix
2323

24-
./utils/lj-releng \
25-
apisix/*.lua \
26-
apisix/admin/*.lua \
27-
apisix/core/*.lua \
28-
apisix/http/*.lua \
29-
apisix/http/router/*.lua \
30-
apisix/plugins/*.lua \
31-
apisix/plugins/grpc-transcode/*.lua \
32-
apisix/plugins/limit-count/*.lua > \
24+
find apisix -name '*.lua' -exec ./utils/lj-releng {} + > \
3325
/tmp/check.log 2>&1 || (cat /tmp/check.log && exit 1)
3426

3527
grep -E "ERROR.*.lua:" /tmp/check.log > /tmp/error.log | true

0 commit comments

Comments
 (0)