本文共 547 字,大约阅读时间需要 1 分钟。
代码风格格式化和代码风格检查遵循Google代码风格。具体风格详见。
模板(点击下载)
设置->Java->CodeStyle->Formatter
选择Import,导入eclipse-java-google-style.xml,然后在Active profile中选择导入的GoogleStyle即可。
需要配合插件的使用
设置->Plugins,查找Eclipse Code Formatter插件,安装并重启。
安装好插件后,导入GoogleStyle模板。
对Checkstyle进行设置,选择Google Checks。
在你想要进行代码检查的项目或类上点击右键,选择CheckStyle->Check Code with Checkstyle进行代码风格检查。
设置->Other Settings->Checkstyle
选择添加(点击下载)模板。
在要检查的类上点右键,选择Check Current File
在CheckStyle视图中选择google_checks规则,然后点击运行。
转载地址:http://llgfl.baihongyu.com/