Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: check lua code style in all Lua file under apisix/ #1518

Merged
merged 1 commit into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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