You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by we...@apache.org on 2020/02/02 01:13:18 UTC
[incubator-apisix] branch master updated: doc: check code style and
test case style. (#1099)
This is an automated email from the ASF dual-hosted git repository.
wenming 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 734b165 doc: check code style and test case style. (#1099)
734b165 is described below
commit 734b1650dd7911185928b17fe4cc95ffdb5f150c
Author: YuanSheng Wang <me...@gmail.com>
AuthorDate: Sun Feb 2 09:13:10 2020 +0800
doc: check code style and test case style. (#1099)
---
Contributing.md | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/Contributing.md b/Contributing.md
index 0a37ada..787a850 100644
--- a/Contributing.md
+++ b/Contributing.md
@@ -86,6 +86,45 @@ Once we've discussed your changes and you've got your code ready, make sure that
* Use a friendly and conversational tone. Always use simple sentences. If the sentence is lengthy try to break it in to smaller sentences.
+## Check code style and test case style
+
+* code style
+ * Please take a look at [OpenResty Lua Coding Style Guide](CODE_STYLE.md).
+ * Use tool to check your code statically by command: `make lint`.
+```shell
+ # install `luacheck` first before run it
+ $ luarocks install luacheck
+ # check source code
+ $ make lint
+ luacheck -q lua
+ Total: 0 warnings / 0 errors in 74 files
+ ./utils/lj-releng lua/*.lua \
+ lua/apisix/*.lua \
+ lua/apisix/admin/*.lua \
+ lua/apisix/core/*.lua \
+ lua/apisix/http/*.lua \
+ lua/apisix/http/router/*.lua \
+ lua/apisix/plugins/*.lua \
+ lua/apisix/plugins/grpc-transcode/*.lua \
+ lua/apisix/plugins/limit-count/*.lua > \
+ /tmp/check.log 2>&1 || (cat /tmp/check.log && exit 1)
+```
+* test case style
+ * Use tool to check your test case style statically by command, eg: `reindex t/admin/*.t`.
+```shell
+ # install `reindex` first before run it
+ # wget https://raw.githubusercontent.com/iresty/openresty-devel-utils/master/reindex
+ # ./reindex test cases
+ $ reindex t/admin/*.t
+ reindex: t/plugin/example.t: skipped. # No changes needed
+ reindex: t/plugin/fault-injection.t: done. # updated
+ reindex: t/plugin/grpc-transcode.t: skipped.
+ ... ...
+ reindex: t/plugin/udp-logger.t: done.
+ reindex: t/plugin/zipkin.t: skipped.
+```
+ * By the way, we can download "reindex" to another path and add this path to "PATH" environment.
+
## Do you have questions about the source code?
- **QQ group**: 552030619