You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/09/29 05:50:39 UTC

[shardingsphere] branch master updated: Add code conduct for forward semantics (#21262)

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

panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new d730c8873d1 Add code conduct for forward semantics (#21262)
d730c8873d1 is described below

commit d730c8873d165ac18fd30a5d7cc23771b2347819
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Thu Sep 29 13:50:30 2022 +0800

    Add code conduct for forward semantics (#21262)
    
    Co-authored-by: shardingsphere <de...@shardingsphere.apache.org>
---
 docs/community/content/involved/conduct/code.cn.md | 1 +
 docs/community/content/involved/conduct/code.en.md | 1 +
 2 files changed, 2 insertions(+)

diff --git a/docs/community/content/involved/conduct/code.cn.md b/docs/community/content/involved/conduct/code.cn.md
index 2376fa1f546..3bc69354bf3 100644
--- a/docs/community/content/involved/conduct/code.cn.md
+++ b/docs/community/content/involved/conduct/code.cn.md
@@ -58,6 +58,7 @@ chapter = true
  - 公开的类和方法必须有 javadoc,其他类和方法以及覆盖自父类的方法无需 javadoc。
  - 条件运算符(<表达式1> ? <表达式2> : <表达式3>)禁止 `嵌套使用`。
  - 热点方法内应避免使用 Java Stream,除非该场景下使用 Stream 的性能优于普通循环。
+ - 条件表达式中,优先使用正向语义,以便于理解代码逻辑。例如:`if (null == param) {} else {}`。
 
 ## 单元测试规范
 
diff --git a/docs/community/content/involved/conduct/code.en.md b/docs/community/content/involved/conduct/code.en.md
index 7c72389b071..0f48b7cf9a7 100644
--- a/docs/community/content/involved/conduct/code.en.md
+++ b/docs/community/content/involved/conduct/code.en.md
@@ -55,6 +55,7 @@ The following code of conduct is based on full compliance with [ASF CODE OF COND
  - Only `public` classes and methods need javadoc, other methods, classes and override methods do not need javadoc.
  - conditional operator(<expression1> ? <expression2> : <expression3>) `nested use` is forbidden.
  - Avoid using Java Stream in hot methods, unless the performance of using Stream is better than using loop in that situation.
+ - Use forward semantics in priority for better understanding code logic in conditional expressions. For example: `if (null == param) {} else {}`.
 
 ## Contributor Covenant Unit Test of Conduct