This is an automated email from the ASF dual-hosted git repository.
zhaojinchao 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 eee7bb04975 Add code-style and inspections files on IDEA (#31289)
eee7bb04975 is described below
commit eee7bb04975baa006382fed00f12035ad529329a
Author: Liang Zhang <[email protected]>
AuthorDate: Sun May 19 15:14:43 2024 +0800
Add code-style and inspections files on IDEA (#31289)
* Fix sonar issues
* Fix sonar issues
* Add code-style and inspections files on IDEA
* Add code-style and inspections files on IDEA
---
docs/community/content/involved/conduct/code.cn.md | 3 +-
docs/community/content/involved/conduct/code.en.md | 3 +-
src/resources/idea/code-style.xml | 37 ++++++++++++++++++++++
.../{code-style-idea.xml => idea/inspections.xml} | 0
4 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/docs/community/content/involved/conduct/code.cn.md
b/docs/community/content/involved/conduct/code.cn.md
index cef304ba1f0..555504f86e9 100644
--- a/docs/community/content/involved/conduct/code.cn.md
+++ b/docs/community/content/involved/conduct/code.cn.md
@@ -23,7 +23,8 @@ chapter = true
- 通过 Spotless 统一代码风格,执行 `./mvnw spotless:apply -Pcheck` 格式化代码。
- 确保覆盖率不低于 master 分支。
- 应尽量将设计精细化拆分;做到小幅度修改,多次数提交,但应保证提交的完整性。
- - 如果您使用 IDEA,可导入推荐的 `src/resources/code-style-idea.xml`。
+ - 如果您使用 IDEA,可导入 `src/resources/idea/code-style.xml`,用于保持代码风格一致性。
+ - 如果您使用 IDEA,可导入 `src/resources/idea/inspections.xml`,用于检测代码潜在问题。
## 编码规范
diff --git a/docs/community/content/involved/conduct/code.en.md
b/docs/community/content/involved/conduct/code.en.md
index 0e65561bb45..34cbf00ea63 100644
--- a/docs/community/content/involved/conduct/code.en.md
+++ b/docs/community/content/involved/conduct/code.en.md
@@ -20,7 +20,8 @@ The following code of conduct is based on full compliance
with [ASF CODE OF COND
- Through the uniform code style of spotless, execute the `./mvnw
spotless:apply -Pcheck` formatted code.
- 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.
- - If using IDEA, you can import the recommended
`src/resources/code-style-idea.xml`.
+ - If you are using IDEA, please import `src/resources/idea/code-style.xml` to
maintain consistency in code style.
+ - If you are using IDEA, please import `src/resources/idea/inspections.xml`
to detect potential issues in the code.
## Contributor Covenant Code of Conduct
diff --git a/src/resources/idea/code-style.xml
b/src/resources/idea/code-style.xml
new file mode 100644
index 00000000000..9e9cdb513b9
--- /dev/null
+++ b/src/resources/idea/code-style.xml
@@ -0,0 +1,37 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<code_scheme name="ShardingSphere" version="173">
+ <JavaCodeStyleSettings>
+ <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
+ <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
+ <option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
+ <option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
+ </JavaCodeStyleSettings>
+ <codeStyleSettings language="JAVA">
+ <option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
+ <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
+ <option name="RESOURCE_LIST_WRAP" value="2" />
+ <option name="IF_BRACE_FORCE" value="3" />
+ <option name="DOWHILE_BRACE_FORCE" value="3" />
+ <option name="WHILE_BRACE_FORCE" value="3" />
+ <option name="FOR_BRACE_FORCE" value="3" />
+ <indentOptions>
+ <option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
+ </indentOptions>
+ </codeStyleSettings>
+</code_scheme>
diff --git a/src/resources/code-style-idea.xml
b/src/resources/idea/inspections.xml
similarity index 100%
rename from src/resources/code-style-idea.xml
rename to src/resources/idea/inspections.xml