CheckStyle 安装与使用

下载地址: http://eclipse-cs.sourceforge.net/
下载解压后将plugins目录下的 com.atlassw.tools.eclipse.checkstyle_<version> 拷贝至eclipse plug-in目录,重启即可。
在eclipse下装好后,在windows下可配置全局的codeStyle检查规范,打开 windows -> preferences 可以看到左边菜单多了项Codestyle菜单
如附件所示:


红色圈住的是sun官方的默认的检查规范。
当然sun的检查规范比较细,也比较全,我们可以根据自己情况来配置自己的Codestyle.xml文件。
上面的myCheck是我自己定义的codeStyle规范。
也可针对某个项目选择check 规范。 选择项目 properties 选项 即可看到,和上图配置差不多。
关于check style文件模板的写法,具体的使用可以去google一把。

引用

The eclipse-cs Checkstyle plug-in integrates the well-known source code analyzer Checkstyle into today's leading IDE - Eclipse.
Checkstyle is a development tool written by Oliver Burn to help you ensure that your Java code adheres to a set of coding standards. Checkstyle does this by inspecting your Java source code and pointing out items that deviate from a defined set of coding rules. The full Checkstyle distribution is included with the Checkstyle plug-in. In addition to using the Eclipse Checkstyle plug-in you can also use Checkstyle from the command line or as part of an Ant build. For more information about using Checkstyle outside of Eclipse see the Checkstyle documentation.

With the Checkstyle Eclipse plug-in your code is constantly inspected for problems. Within the Eclipse workbench you are notified of problems via the Eclipse Problems View and source code annotations just as you would see with compiler errors or warnings.

你可能感兴趣的:(eclipse,windows,ant,Google,sun)