Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #2992] Add text import guide in codeStyle.md to enhance code style import #3088

Merged
merged 1 commit into from
Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion style/NacosCheckStyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<property name="allowedAnnotations"
value="Override, Test, Before, After, BeforeClass, AfterClass, Parameterized, Parameters"/>
<property name="ignoreMethodNamesRegex" value="^set[A-Z].*|^get[A-Z].*"/>
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF"/>
<property name="tokens" value="METHOD_DEF, ANNOTATION_FIELD_DEF"/>
</module>
<module name="SingleLineJavadoc">
<property name="ignoreInlineTags" value="false"/>
Expand Down
33 changes: 21 additions & 12 deletions style/codeStyle.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,28 @@ Nacos code style Comply with Alibaba Java Coding Guidelines and code style file

Nacos的编码规范遵从于《阿里巴巴JAVA开发规约》和社区制定的Nacos代码风格文件。


### Guidelines
[Alibaba-Java-Coding-Guidelines](https://alibaba.github.io/Alibaba-Java-Coding-Guidelines/)

[阿里巴巴JAVA开发规约](https://github.com/alibaba/p3c/blob/master/%E9%98%BF%E9%87%8C%E5%B7%B4%E5%B7%B4Java%E5%BC%80%E5%8F%91%E6%89%8B%E5%86%8C%EF%BC%88%E5%8D%8E%E5%B1%B1%E7%89%88%EF%BC%89.pdf)

### Nacos Code Style File
[community issue](https://github.com/alibaba/nacos/issues/2992)

## Nacos Code Style File

### Idea IDE

#### Idea IDE
Nacos Code Style file is `style/nacos-code-style-for-idea.xml` in source code. Developers can import it to Idea IDE and reformat code by IDE.

Nacos Code Style file is `style/NacosStyleForIdea.xml` in source code. Developers can import it to Idea IDE and reformat code by IDE.
Nacos代码风格文件在源代码下的`style/nacos-code-style-for-idea.xml`文件中,开发者可以将其倒入到Idea IDE中,并让IDE帮助您格式化代码。

Nacos代码风格文件在源代码下的`style/NacosStyleForIdea.xml`文件中,开发者可以将其倒入到Idea IDE中,并让IDE帮助您格式化代码。
#### Import Way/导入方式

#### eclipse IDE
```
Preferences/Settings --> Editor --> Code Style --> Schema --> Import Schema --> IntelliJ IDEA code style XML
```

### eclipse IDE

Volunteer wanted.

Expand All @@ -41,15 +48,17 @@ Volunteer wanted.
#### checkstyle
[chechstyle-idea-install](https://plugins.jetbrains.com/plugin/1065-checkstyle-idea)

1. Set checkstyle version at least 8.30 and scan scope `All resource(including tests)` in checkstyle plugin.
2. Import `style/NacosCheckStyle.xml` to checkstyle plugin.
3. Scan and check your modified code by plugin.
1. Preferences/Settings --> Other Settings --> Checkstyle
2. Set checkstyle version at least 8.30 and scan scope `All resource(including tests)` in checkstyle plugin.
3. Import `style/NacosCheckStyle.xml` to checkstyle plugin.
4. Scan and check your modified code by plugin.

[chechstyle插件idea安装](https://plugins.jetbrains.com/plugin/1065-checkstyle-idea)

1. 在checkstyle插件中设置checkstyle版本至少为8.30,并将扫描作用域设置为`All resource(including tests)`
2. 倒入源代码下`style/NacosCheckStyle.xml`文件到checkstyle插件。
3. 用checkstyle插件扫描你修改的代码。
1. Preferences/Settings --> Other Settings --> Checkstyle
2. 在checkstyle插件中设置checkstyle版本至少为8.30,并将扫描作用域设置为`All resource(including tests)`
3. 导入源代码下`style/NacosCheckStyle.xml`文件到checkstyle插件。
4. 用checkstyle插件扫描你修改的代码。

### eclipse IDE

Expand Down
File renamed without changes.