This is an automated email from the ASF dual-hosted git repository.
dengliming pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shenyu-website.git
The following commit(s) were added to refs/heads/main by this push:
new a5d796fb00e Added code suggestion (#831)
a5d796fb00e is described below
commit a5d796fb00eee30cd3880dafaeca69893e96a743
Author: 愿凌飞 <[email protected]>
AuthorDate: Sun Dec 4 19:36:07 2022 +0800
Added code suggestion (#831)
---
community/1-code-suggestions.md | 8 +++++---
.../current/1-code-suggestions.md | 2 ++
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/community/1-code-suggestions.md b/community/1-code-suggestions.md
index 9aeb5a7b0c4..07b9dbfa3ef 100644
--- a/community/1-code-suggestions.md
+++ b/community/1-code-suggestions.md
@@ -29,6 +29,8 @@ cover: "/img/architecture/shenyu-framework.png"
* When adding a new file, you need to add the [apache
protocol](https://github.com/apache/shenyu-website/blob/57f9a6b14c27d97137275453b207232f3df53205/LICENSE#L191-L201)
in the header of the file.
+* Try not to use a third party utility class directly. Check to see if it is
included in the util package for this project
+
## Object
@@ -159,7 +161,7 @@ try {
current : ```A a = null == b ? cMap.values().iterator().next() :
cMap.get(d);```
current : ```return null == a ? new B() : new B(c);```
recommendation : No modification.
-
+
* Judge collection is null or not, below are some representative examples:
current :
@@ -167,10 +169,10 @@ try {
private boolean isEmpty(final List<String> xxx) {
return null == xxx || xxx.isEmpty();
}
- ```
+ ```
recommendation : Add a collection tool class to make unified judgment.
-
+
* Judge Map's value is Null or not, below are some representative examples:
current :
diff --git
a/i18n/zh/docusaurus-plugin-content-docs-community/current/1-code-suggestions.md
b/i18n/zh/docusaurus-plugin-content-docs-community/current/1-code-suggestions.md
index 6e72dde2dd2..b8bf8addfc9 100644
---
a/i18n/zh/docusaurus-plugin-content-docs-community/current/1-code-suggestions.md
+++
b/i18n/zh/docusaurus-plugin-content-docs-community/current/1-code-suggestions.md
@@ -29,6 +29,8 @@ cover: "/img/architecture/shenyu-framework.png"
* 添加新文件时,需要在文件头添加
[apache协议](https://github.com/apache/shenyu-website/blob/57f9a6b14c27d97137275453b207232f3df53205/LICENSE#L191-L201)
+* 尽量不直接使用第三方工具类,先查看本项目util包下是否包含。
+
## Object
* 使用`Optional` 来转换 `Null` 对象。