zoukankan      html  css  js  c++  java
  • Eclipse插件CheckStyle安装使用

    1、CheckStyle简介
      Checkstyle是一款检查Java程序源代码样式的工具,它可以有效的帮助我们检视代码以便更好的遵循代码编写标准,特别适用于小组开发时彼此间的样式规范和统一。Checkstyle提供了高可配置性,以便适用于各种代码规范,所以除了使用它提供的几种常见标准之外,你也可以定制自己的标准.
    最新版本下载地址:http://sourceforge.net/projects/eclipse-cs/?source=directory
     
    2、在Eclipse中安装插件
      一.在线安装
        安装地址:http://eclipse-cs.sourceforge.net/update/
      二.下载Eclipse plugin 的版本,解压zip文件。
        下载后,把里面的两个文件夹plugins和 features下面的文件分别拷贝到eclipse目录下面对应的plugins和features目录,重新启动Eclipse .
     
    PS:直接启动eclipse 可能会出现ClassNotFoundExceptions 等错误,在启动eclipse的时候加上一个参数 -clean. 这样eclipse就可以更新它当前安装的许多插件信息
     
    3、 CheckStyle使用
     
      选中工程,右键选择checkstyle->check code with checkstyle,检查错误即可
     
    4、Checkstyle的结果输出
      1 Type is missing a javadoc commentClass  缺少类型说明
      2 “{” should be on the previous line “{” 应该位于前一行
      3 Methos is missing a javadoc comment方法前面缺少javadoc注释
      4 Expected @throws tag for “Exception”在注释中希望有@throws的说明
      5 “.” Is preceeded with whitespace “.” 前面不能有空格
      6 “.” Is followed by whitespace“.” 后面不能有空格
      7 “=” is not preceeded with whitespace“=” 前面缺少空格
      8“=” is not followed with whitespace“=” 后面缺少空格
      9 “}” should be on the same line“}” 应该与下条语句位于同一行
      10 Unused @param tag for “unused”没有参数“unused”,不需注释
      11 Variable “CA” missing javadoc变量“CA”缺少javadoc注释
      12 Line longer than 80characters行长度超过80
      13 Line contains a tab character行含有”tab” 字符
      14 Redundant “Public” modifier冗余的“public” modifier
      15 Final modifier out of order with the JSL suggestionFinal modifier的顺序错误
      16 Avoid using the “.*” form of importImport格式避免使用“.*”
      17 Redundant import from the same package从同一个包中Import内容
      18 Unused import-java.util.listImport进来的java.util.list没有被使用
      19 Duplicate import to line 13重复Import同一个内容
      20 Import from illegal package从非法包中 Import内容
      21 “while” construct must use “{}”“while” 语句缺少“{}”
      22 Variable “sTest1” must be private and have accessor method变量“sTest1”应该是private的,并且有调用它的方法
      23 Variable “ABC” must match pattern “^[a-z][a-zA-Z0-9]*$”变量“ABC”不符合命名规则“^[a-z][a-zA-Z0-9]*$”
      24 “(” is followed by whitespace“(” 后面不能有空格 25“)” is proceeded by whitespace“)” 前面不能有空格
     
    参考文档:
      CheckStyle官网:http://checkstyle.sourceforge.net
  • 相关阅读:
    最大子数组问题(分治策略实现)
    Solving the Detached Many-to-Many Problem with the Entity Framework
    Working With Entity Framework Detached Objects
    Attaching detached POCO to EF DbContext
    如何获取qq空间最近访问人列表
    Health Monitoring in ASP.NET 2.0
    problem with displaying the markers on Google maps
    WebMatrix Database.Open… Close() and Dispose()
    Accessing and Updating Data in ASP.NET: Retrieving XML Data with XmlDataSource Control
    Create web setup project that has crystal reports and sql script run manually on client system
  • 原文地址:https://www.cnblogs.com/zq-inlook/p/3514096.html
Copyright © 2011-2022 走看看