This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 06acbe9  test: check lua code style in all Lua file under apisix/ 
(#1518)
06acbe9 is described below

commit 06acbe90477aa9dabca12b4d4828954f91c0f4c5
Author: 罗泽轩 <[email protected]>
AuthorDate: Tue Apr 28 15:53:04 2020 +0800

    test: check lua code style in all Lua file under apisix/ (#1518)
---
 apisix/plugins/prometheus/exporter.lua   |  1 +
 apisix/plugins/zipkin/codec.lua          |  4 ++++
 apisix/plugins/zipkin/random_sampler.lua |  6 ++++++
 apisix/plugins/zipkin/reporter.lua       |  5 +++++
 apisix/stream/plugins/mqtt-proxy.lua     |  2 ++
 utils/check-lua-code-style.sh            | 10 +---------
 6 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/apisix/plugins/prometheus/exporter.lua 
b/apisix/plugins/prometheus/exporter.lua
index 06243f8..538deab 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 1d888fb..a6a2739 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 0a92904..f2ee5b4 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 8d6b4c0..cc71fc5 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 439eee2..f8d3552 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 caee7b4..6cb80d3 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

Reply via email to