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 2026/09/03 13:11:46 UTC
(shardingsphere) branch master updated: Remove obsolete LinkedList and Hamcrest guidelines (#39717)
This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 d585b73a299 Remove obsolete LinkedList and Hamcrest guidelines (#39717)
d585b73a299 is described below
commit d585b73a2993612568711940e2217625b5c45f06
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Thu Sep 3 21:11:40 2026 +0800
Remove obsolete LinkedList and Hamcrest guidelines (#39717)
---
CODE_OF_CONDUCT.md | 2 --
docs/community/content/involved/conduct/code.cn.md | 2 --
docs/community/content/involved/conduct/code.en.md | 2 --
3 files changed, 6 deletions(-)
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index ae361b91c77..326324ec394 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -61,7 +61,6 @@ The following code of conduct is based on full compliance with the [Apache Softw
- Method parameters and return values are not allowed to be `null`.
- Method parameters must not use `Optional`; pass plain values (nullable when needed).
- Prefer using lombok instead of constructors, getter, setter methods and log variables.
-- Consider using `LinkedList` first, only use `ArrayList` when you need to get element values from the collection by index.
- Collection types that may cause expansion like `ArrayList`, `HashMap` must specify initial collection size to avoid expansion.
- Prefer using ternary operators instead of if else return and assignment statements.
- In conditional expressions, prefer positive semantics for easier code logic understanding. For example: `if (null == param) {} else {}`.
@@ -107,7 +106,6 @@ The following code of conduct is based on full compliance with the [Apache Softw
- Type assertions must use `assertThat(actual, isA(ExpectedType.class))`;
- Reference identity assertions must use `assertThat(actual, sameInstance(expected))`;
- Reference non-identity assertions must use `assertThat(actual, not(sameInstance(expected)))`;
- - Use Hamcrest matchers like `is()`, `not()` for precise and readable assertions.
- The actual values in test cases should be named actual XXX, and expected values should be named expected XXX.
- Using `mock` should follow the following specifications:
- Mock databases, caches, registries, network calls, time, and other heavy external dependencies instead of connecting to external environments.
diff --git a/docs/community/content/involved/conduct/code.cn.md b/docs/community/content/involved/conduct/code.cn.md
index cdab27814a0..7bde17fa520 100644
--- a/docs/community/content/involved/conduct/code.cn.md
+++ b/docs/community/content/involved/conduct/code.cn.md
@@ -65,7 +65,6 @@ chapter = true
- 方法入参和返回值不允许为 `null`。
- 方法入参禁止使用 `Optional`;应传递普通值(必要时允许为 `null`)。
- 优先使用 lombok 代替构造器,getter, setter 方法和 log 变量。
- - 优先考虑使用 `LinkedList`,只有在需要通过下标获取集合中元素值时再使用 `ArrayList`。
- `ArrayList`,`HashMap` 等可能产生扩容的集合类型必须指定集合初始大小,避免扩容。
- 优先使用三目运算符代替 if else 的返回和赋值语句。
- 条件表达式中,优先使用正向语义,以便于理解代码逻辑。例如:`if (null == param) {} else {}`。
@@ -112,7 +111,6 @@ chapter = true
- 类型断言必须使用 `assertThat(actual, isA(ExpectedType.class))`;
- 引用同一性断言必须使用 `assertThat(actual, sameInstance(expected))`;
- 引用非同一性断言必须使用 `assertThat(actual, not(sameInstance(expected)))`;
- - 使用 Hamcrest 匹配器(如 `is()`、`not()`)来进行精确且可读性高的断言。
- 测试用例的真实值应名为为 actual XXX,期望值应命名为 expected XXX。
- 使用 `mock` 应遵循如下规范:
- 数据库、缓存、注册中心、网络调用、时间以及其他重量级外部依赖应使用 mock,不要连接外部环境。
diff --git a/docs/community/content/involved/conduct/code.en.md b/docs/community/content/involved/conduct/code.en.md
index 05223280883..a0ff5ed3fae 100644
--- a/docs/community/content/involved/conduct/code.en.md
+++ b/docs/community/content/involved/conduct/code.en.md
@@ -65,7 +65,6 @@ The following code of conduct is based on full compliance with the [Apache Softw
- Method parameters and return values are not allowed to be `null`.
- Method parameters must not use `Optional`; pass plain values (nullable when needed).
- Prefer using lombok instead of constructors, getter, setter methods and log variables.
-- Consider using `LinkedList` first, only use `ArrayList` when you need to get element values from the collection by index.
- Collection types that may cause expansion like `ArrayList`, `HashMap` must specify initial collection size to avoid expansion.
- Prefer using ternary operators instead of if else return and assignment statements.
- In conditional expressions, prefer positive semantics for easier code logic understanding. For example: `if (null == param) {} else {}`.
@@ -112,7 +111,6 @@ The following code of conduct is based on full compliance with the [Apache Softw
- Type assertions must use `assertThat(actual, isA(ExpectedType.class))`;
- Reference identity assertions must use `assertThat(actual, sameInstance(expected))`;
- Reference non-identity assertions must use `assertThat(actual, not(sameInstance(expected)))`;
- - Use Hamcrest matchers like `is()`, `not()` for precise and readable assertions.
- The actual values in test cases should be named actual XXX, and expected values should be named expected XXX.
- Using `mock` should follow the following specifications:
- Mock databases, caches, registries, network calls, time, and other heavy external dependencies instead of connecting to external environments.