You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/08/25 11:15:32 UTC

[shardingsphere] branch master updated: Add : add more content to the code conduct (#20508)

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

zhangliang 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 2a7f00a3248 Add : add more content to the code conduct (#20508)
2a7f00a3248 is described below

commit 2a7f00a3248a25950e9260160ebe008192578e73
Author: 孙念君 Nianjun Sun <su...@sphere-ex.com>
AuthorDate: Thu Aug 25 19:15:22 2022 +0800

    Add : add more content to the code conduct (#20508)
    
    * Add : add more content to the code conduct
    
    * Refactor : refactor the description of new code conduct
    
    * Refactor : refactor the description of abbreviation code conduct
    
    * Refactor : refactor the code conduct of abbreviation naming rule
    
    * Format : format the code conduct document
---
 docs/community/content/contribute/code-conduct.cn.md | 7 ++++++-
 docs/community/content/contribute/code-conduct.en.md | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/docs/community/content/contribute/code-conduct.cn.md b/docs/community/content/contribute/code-conduct.cn.md
index 430902c82f0..3be931f89c5 100644
--- a/docs/community/content/contribute/code-conduct.cn.md
+++ b/docs/community/content/contribute/code-conduct.cn.md
@@ -29,7 +29,12 @@ chapter = true
 
  - 使用 linux 换行符。
  - 不应有无意义的空行。请提炼私有方法,代替方法体过长或代码段逻辑闭环而采用的空行间隔。
- - 类、方法和变量的命名要做到顾名思义,避免使用缩写。
+ - 类、方法和变量的命名要做到顾名思义,类、方法名避免使用缩写,部分变量名可以使用缩写。
+   - 变量名 properties 可缩写为 `props`,configuration 缩写为 `config`。
+ - 2 位及 3 位字符的专有名词缩写使用大写,超过 3 位字符的缩写采用驼峰形式。
+   - 2 位及 3 位字符的缩写:DBDiscoveryExampleScenario、SQL92Lexer、XMLTransfer、MySQLAdminExecutorCreator。
+   - 如果是本地变量,缩写应该使用小写:dbName、mysqlAuthenticationMethod、sqlStatement、mysqlConfig。
+   - 3 位字符以上的缩写应使用驼峰形式:JdbcUrlAppender、YamlAgentConfigurationSwapper。
  - 返回值变量使用 `result` 命名;循环中使用 `each` 命名循环变量;map 中使用 `entry` 代替 `each`。
  - 捕获的异常名称命名为 `ex` ;捕获异常且不做任何事情,异常名称命名为 `ignored`。
  - 配置文件使用 `Spinal Case` 命名(一种使用 `-` 分割单词的特殊 `Snake Case`)。
diff --git a/docs/community/content/contribute/code-conduct.en.md b/docs/community/content/contribute/code-conduct.en.md
index 9fe14c3c638..72092809879 100644
--- a/docs/community/content/contribute/code-conduct.en.md
+++ b/docs/community/content/contribute/code-conduct.en.md
@@ -26,7 +26,12 @@ The following code of conduct is based on full compliance with [ASF CODE OF COND
 
  - Use linux line separators.
  - No meaningless blank lines. Please extract private methods to instead of blank lines if too long method body or different logic code fragments.
- - Use meaningful class, method and variable names, avoid to use abbreviate. 
+ - Use meaningful class, method and variable names, class and method name avoid to use abbreviation. Some variables could use abbreviation.
+   - Variables `properties` could abbreviate to `props`, `configuration` could abbreviate to `config`.
+ - Abbreviation composed of 2 or 3 characters should be uppercase, more than 3 characters must use camelCase naming rule.
+   - Example for abbreviation composed of 2 or 3 characters: DBDiscoveryExampleScenario, SQL92Lexer, XMLTransfer, MySQLAdminExecutorCreator.
+   - A variable composed of abbreviation should be lowercase: dbName, mysqlAuthenticationMethod, sqlStatement, mysqlConfig.
+   - Abbreviation composed more than 3 characters should use camelCase naming rule: JdbcUrlAppender, YamlAgentConfigurationSwapper.
  - Return values are 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).