Skip to content

Commit

Permalink
test: check lua code style in all Lua file under apisix/ (apache#1518)
Browse files Browse the repository at this point in the history
  • Loading branch information
spacewander authored and SaberMaster committed Jun 30, 2020
1 parent a710cb2 commit 1775b29
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions apisix/plugins/prometheus/exporter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions apisix/plugins/zipkin/codec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 6 additions & 0 deletions apisix/plugins/zipkin/random_sampler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
5 changes: 5 additions & 0 deletions apisix/plugins/zipkin/reporter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
2 changes: 2 additions & 0 deletions apisix/stream/plugins/mqtt-proxy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 1 addition & 9 deletions utils/check-lua-code-style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1775b29

Please # to comment.