简介:一个检查代码风格的插件,比如像命名约定,类设计等方面进行代码规范和风格的检查。
官网:https://github.com/jshiell/checkstyle-idea
谷歌代码规范:Google Java Style Guide
PS:目前公司用的是阿里出的Java代码规范【Alibaba Java Coding Guidelines】插件,80K下载,大小7.8 M
配置:Other Settings --> CheckStyle --> 添加规范文件,或勾选推荐的规范文件
文档:
This plugin provides both real-time and on-demand scanning of Java files with CheckStyle from within IDEA.
这个插件可以在IDEA中使用提供的CheckStyle实时和按需扫描Java文件。
Once installed, a new inspection will be available in the group ‘CheckStyle‘. The ‘Inspections‘ item in the preferences panel will allow you to turn this on and to configure it.
安装完成后,一个新的 inspection 将出现在“CheckStyle”组中。首选项面板中的“Inspections”项目将允许您打开并配置它。
Project exceptions are treated a little oddly. Because CheckStyle demands these to be on the current classpath errors will appear if these have not as yet been compiled. Further, because we cache the real-time checkers for performance reasons, real-time scans may continue to show the errors after a compilation. A static scan will force a reload of the Checker and should resolve this.
项目例外有点奇怪。因为CheckStyle要求它们在当前类路径上,所以如果它们还没有被编译的话,错误将会出现。此外,由于出于性能原因而缓存实时检查器,实时扫描可能在编译后继续显示错误。静态扫描将强制重新加载检查器,并应解决此问题。