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/11/12 01:22:52 UTC

[shardingsphere] branch master updated: Update code conduct (#22093)

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 7367a56e493 Update code conduct (#22093)
7367a56e493 is described below

commit 7367a56e49301d585d85f925ccb70e3758c2406a
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Nov 12 09:22:45 2022 +0800

    Update code conduct (#22093)
---
 docs/community/content/involved/conduct/code.cn.md | 16 ++++++++--------
 docs/community/content/involved/conduct/code.en.md | 16 ++++++++--------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/docs/community/content/involved/conduct/code.cn.md b/docs/community/content/involved/conduct/code.cn.md
index d413dd2a4a6..2ae52c34e42 100644
--- a/docs/community/content/involved/conduct/code.cn.md
+++ b/docs/community/content/involved/conduct/code.cn.md
@@ -18,12 +18,12 @@ chapter = true
 
 ## 代码提交行为规范
 
- - 确保构建流程中的各个步骤都成功完成,包括:Apache 协议文件头检查、Checkstyle 检查、编译、单元测试等。构建流程启动命令:`mvn -T 1C clean install`。执行目录有 2 种选择,根据自己的熟悉程度做选择:1)对项目还不太熟悉,在项目根目录执行构建,所有模块都会执行构建,2)明确知道这次改动会影响到哪些模块,在这些模块执行构建,可以大大缩短构建时间。
+ - 确保遵守编码规范。
+ - 确保构建流程中的各个步骤都成功完成,包括:Apache 协议文件头检查、Checkstyle 检查、编译、单元测试等。构建流程启动命令:`./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`。
  - 确保覆盖率不低于 master 分支。
  - 应尽量将设计精细化拆分;做到小幅度修改,多次数提交,但应保证提交的完整性。
- - 确保遵守编码规范。
- - 如果您使用 IDEA,可导入推荐的 `src/resources/code-style-idea.xml`。
  - 通过 Spotless 统一代码风格,执行 `mvn spotless:apply` 格式化代码。
+ - 如果您使用 IDEA,可导入推荐的 `src/resources/code-style-idea.xml`。
  
 ## 编码规范
 
@@ -36,10 +36,10 @@ chapter = true
    - 变量名 `properties` 缩写为 `props`;
    - 变量名 `configuration` 缩写为 `config`。
  - 三位以内字符的专有名词缩写使用大写,超过三位字符的缩写采用驼峰形式。
-   - 三位以内字符的类和方法名称缩写的示例:DBDiscoveryExampleScenario、SQL92Lexer、XMLTransfer、MySQLAdminExecutorCreator;
+   - 三位以内字符的类和方法名称缩写的示例:SQL92Lexer、XMLTransfer、MySQLAdminExecutorCreator;
    - 三位以上字符的类和方法名称缩写的示例:JdbcUrlAppender、YamlAgentConfigurationSwapper;
-   - 变量应使用小驼峰形式:dbName、mysqlAuthenticationMethod、sqlStatement、mysqlConfig。
- - 除了直接返回参数,返回变量使用 `result` 命名;循环中使用 `each` 命名循环变量;map 中使用 `entry` 代替 `each`。
+   - 变量应使用小驼峰形式:mysqlAuthenticationMethod、sqlStatement、mysqlConfig。
+ - 除了直接返回方法入参,返回变量使用 `result` 命名;循环中使用 `each` 命名循环变量;map 中使用 `entry` 代替 `each`。
  - 捕获的异常名称命名为 `ex` ;捕获异常且不做任何事情,异常名称命名为 `ignored`。
  - 配置文件使用 `Spinal Case` 命名(一种使用 `-` 分割单词的特殊 `Snake Case`)。
  - 需要注释解释的代码尽量提成小方法,用方法名称解释。
@@ -59,10 +59,10 @@ chapter = true
  - 日志与注释一律使用英文。
  - 注释只能包含 javadoc,todo 和 fixme。
  - 公开的类和方法必须有 javadoc,其他类和方法以及覆盖自父类的方法无需 javadoc。
- - 条件运算符(<表达式1> ? <表达式2> : <表达式3>)禁止 `嵌套使用`。
- - 热点方法内应避免使用 Java Stream,除非该场景下使用 Stream 的性能优于普通循环。
+ - 禁止嵌套使用三目运算符。
  - 条件表达式中,优先使用正向语义,以便于理解代码逻辑。例如:`if (null == param) {} else {}`。
  - 使用具体的 `@SuppressWarnings("xxx")` 代替 `@SuppressWarnings("all")`。
+ - 热点方法内应避免使用 Java Stream,除非该场景下使用 Stream 的性能优于普通循环。
 
 ## 单元测试规范
 
diff --git a/docs/community/content/involved/conduct/code.en.md b/docs/community/content/involved/conduct/code.en.md
index 546afe61cc8..87cfce5c5b6 100644
--- a/docs/community/content/involved/conduct/code.en.md
+++ b/docs/community/content/involved/conduct/code.en.md
@@ -15,12 +15,12 @@ The following code of conduct is based on full compliance with [ASF CODE OF COND
 
 ## Contributor Covenant Submitting of Conduct
 
- - Make sure Maven build process success. Run `mvn -T 1C clean install` command in shell to start Maven build process. On which directory to run Maven build process, there are 2 alternatives, we could select one of them: 1) if we're not familiar with Apache ShardingSphere, then we could run it on project root directory, 2) if we know which modules will be affected by the changes, then we could run it on these modules to save build time.
+ - Conform to `Contributor Covenant Code of Conduct` below.
+ - Make sure Maven build process success. Run `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e` command in shell to start Maven build process.
  - Make sure the test coverage rate is not lower than the master branch.
  - Careful consideration for each `pull request`; Small and frequent `pull request` with complete unit function is welcomed.
- - Conform to `Contributor Covenant Code of Conduct` below.
- - If using IDEA, you can import the recommended `src/resources/code-style-idea.xml`.
  - Through the uniform code style of spotless, execute the `mvn spotless:apply` formatted code.
+ - If using IDEA, you can import the recommended `src/resources/code-style-idea.xml`.
 
 ## Contributor Covenant Code of Conduct
 
@@ -33,10 +33,10 @@ The following code of conduct is based on full compliance with [ASF CODE OF COND
    - Variable `properties` could abbreviate to `props`;
    - Variable `configuration` could abbreviate to `config`.
  - Abbreviation composed less than 3 characters should be uppercase, more than 3 characters must use camel case naming rule.
-   - Example for abbreviation composed less than 3 characters: DBDiscoveryExampleScenario, SQL92Lexer, XMLTransfer, MySQLAdminExecutorCreator;
+   - Example for abbreviation composed less than 3 characters: SQL92Lexer, XMLTransfer, MySQLAdminExecutorCreator;
    - Example for abbreviation composed more than 3 characters: JdbcUrlAppender, YamlAgentConfigurationSwapper;
-   - A variable composed of abbreviation should use lower camel case: dbName, mysqlAuthenticationMethod, sqlStatement, mysqlConfig.
- - Except return parameter as result, returning variable should be named with `result`; Variables in the loop structure are named with `each`; Replace `each` with `entry` in map.
+   - A variable composed of abbreviation should use lower camel case: mysqlAuthenticationMethod, sqlStatement, mysqlConfig.
+ - Except return an input parameter as result, returning variable should be named with `result`; Variables in the loop structure are named with `each`; Replace `each` with `entry` in map.
  - Exceptions when catch are named with `ex`; Exceptions when catch but do nothing are named with `ignored`.
  - Name property files with `Spinal Case`(a variant of `Snake Case` which uses hyphens `-` to separate words). 
  - Split codes that need to add notes with it into small methods, which are explained with method names.
@@ -56,10 +56,10 @@ The following code of conduct is based on full compliance with [ASF CODE OF COND
  - Use English in all the logs and javadoc.
  - Include Javadoc, todo and fixme only in the comments.
  - 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.
+ - Nested using conditional operator is forbidden.
  - Use forward semantics in priority for better understanding code logic in conditional expressions. For example: `if (null == param) {} else {}`.
  - Use concentrate `@SuppressWarnings("xxx")` instead of `@SuppressWarnings("all")`.
+ - Avoid using Java Stream in hot methods, unless the performance of using Stream is better than using loop in that situation.
 
 ## Contributor Covenant Unit Test of Conduct