32 lines
1.2 KiB
Markdown
32 lines
1.2 KiB
Markdown
|
||
|
||
## Code Style
|
||
编码规范遵从于《阿里巴巴JAVA开发规约》,基于google style。
|
||
|
||
### 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)
|
||
|
||
|
||
|
||
## Code Style File
|
||
|
||
### Idea IDE
|
||
|
||
代码风格文件在源代码下的`style/code-style-for-idea.xml`文件中,开发者可以将其导入到Idea IDE中,并让IDE帮助您格式化代码。
|
||
|
||
#### Import Way/导入方式
|
||
|
||
```
|
||
Preferences/Settings --> Editor --> Code Style --> Schema --> Import Schema --> IntelliJ IDEA code style XML
|
||
```
|
||
|
||
#### checkstyle
|
||
[checkstyle插件idea安装](https://plugins.jetbrains.com/plugin/1065-checkstyle-idea)
|
||
|
||
1. `Preferences/Settings --> Other Settings --> Checkstyle` 或者 `Preferences/Settings --> Tools --> Checkstyle`
|
||
2. 在checkstyle插件中设置checkstyle版本至少为8.30,并将扫描作用域设置为`All resource(including tests)`
|
||
3. 导入源代码下`style/CheckStyle.xml`文件到checkstyle插件。
|
||
4. 用checkstyle插件扫描你修改的代码。
|