2019独角兽企业重金招聘Python工程师标准>>>

checkstyle安装使用

1. 按照安装findbugs的方式按照checkstyle插件

安装过程中的截图如下:

受网速和软件大小限制可能比较耗时请耐心等待:

2. 导入checkstyle的规则约定文件

xdja_checkstyle.xml 文件编码为:utf-8.文件内容如下:

<?xml version="1.0"?>
<!DOCTYPE module PUBLIC"-//Puppy Crawl//DTD Check Configuration 1.3//EN""http://www.puppycrawl.com/dtds/configuration_1_3.dtd"><!--Checkstyle configuration that checks the sun coding conventions from:- the Java Language Specification athttp://java.sun.com/docs/books/jls/second_edition/html/index.html- the Sun Code Conventions at http://java.sun.com/docs/codeconv/- the Javadoc guidelines athttp://java.sun.com/j2se/javadoc/writingdoccomments/index.html- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html- some best practicesCheckstyle is very configurable. Be sure to read the documentation athttp://checkstyle.sf.net (or in your downloaded distribution).Most Checks are configurable, be sure to consult the documentation.To completely disable a check, just comment it out or delete it from the file.Finally, it is worth reading the documentation.--><module name="Checker"><property name="severity" value="warning"/><!-- Checks that a package-info.java file exists for each package.     --><!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage --><module name="JavadocPackage"/><!-- Checks whether files end with a new line.                        --><!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile --><module name="NewlineAtEndOfFile"><property name="severity" value="ignore"/></module><!-- Checks that property files contain the same keys.         --><!-- See http://checkstyle.sf.net/config_misc.html#Translation --><module name="Translation"/><!-- Checks for Size Violations.                    --><!-- See http://checkstyle.sf.net/config_sizes.html --><module name="FileLength"/><!-- Checks for whitespace                               --><!-- See http://checkstyle.sf.net/config_whitespace.html --><module name="FileTabCharacter"><property name="severity" value="ignore"/></module><!-- Miscellaneous other checks.                   --><!-- See http://checkstyle.sf.net/config_misc.html --><module name="RegexpSingleline"><property name="severity" value="ignore"/><property name="format" value="\s+$"/><property name="minimum" value="0"/><property name="maximum" value="0"/><property name="message" value="Line has trailing spaces."/></module><!-- Checks for Headers                                --><!-- See http://checkstyle.sf.net/config_header.html   --><!-- <module name="Header"> --><!--   <property name="headerFile" value="${checkstyle.header.file}"/> --><!--   <property name="fileExtensions" value="java"/> --><!-- </module> --><module name="TreeWalker"><property name="tabWidth" value="4"/><!-- Checks for Javadoc comments.                     --><!-- See http://checkstyle.sf.net/config_javadoc.html --><module name="JavadocMethod"><property name="logLoadErrors" value="true"/><property name="suppressLoadErrors" value="true"/></module><module name="JavadocType"/><module name="JavadocVariable"/><module name="JavadocStyle"/><!-- Checks for Naming Conventions.                  --><!-- See http://checkstyle.sf.net/config_naming.html --><module name="ConstantName"/><module name="LocalFinalVariableName"/><module name="LocalVariableName"/><module name="MemberName"/><module name="MethodName"/><module name="PackageName"/><module name="ParameterName"/><module name="StaticVariableName"/><module name="TypeName"/><!-- Checks for imports                              --><!-- See http://checkstyle.sf.net/config_import.html --><module name="AvoidStarImport"/><module name="IllegalImport"/> <!-- defaults to sun.* packages --><module name="RedundantImport"/><module name="UnusedImports"/><!-- Checks for Size Violations.                    --><!-- See http://checkstyle.sf.net/config_sizes.html --><module name="LineLength"/><module name="MethodLength"/><module name="ParameterNumber"/><!-- Checks for whitespace                               --><!-- See http://checkstyle.sf.net/config_whitespace.html --><module name="EmptyForIteratorPad"/><module name="GenericWhitespace"/><module name="MethodParamPad"/><module name="NoWhitespaceAfter"><property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/></module><module name="NoWhitespaceBefore"/><module name="OperatorWrap"/><module name="ParenPad"/><module name="TypecastParenPad"/><module name="WhitespaceAfter"/><module name="WhitespaceAround"><property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAND,LCURLY,LE,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,RCURLY,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT,TYPE_EXTENSION_AND,WILDCARD_TYPE"/></module><!-- Modifier Checks                                    --><!-- See http://checkstyle.sf.net/config_modifiers.html --><module name="ModifierOrder"/><module name="RedundantModifier"/><!-- Checks for blocks. You know, those {}'s         --><!-- See http://checkstyle.sf.net/config_blocks.html --><module name="AvoidNestedBlocks"/><module name="EmptyBlock"/><module name="LeftCurly"/><module name="NeedBraces"/><module name="RightCurly"/><!-- Checks for common coding problems               --><!-- See http://checkstyle.sf.net/config_coding.html --><module name="AvoidInlineConditionals"/><module name="EmptyStatement"/><module name="EqualsHashCode"/><module name="HiddenField"/><module name="IllegalInstantiation"/><module name="InnerAssignment"/><module name="MagicNumber"/><module name="MissingSwitchDefault"/><module name="SimplifyBooleanExpression"/><module name="SimplifyBooleanReturn"/><!-- Checks for class design                         --><!-- See http://checkstyle.sf.net/config_design.html --><module name="DesignForExtension"/><module name="FinalClass"/><module name="HideUtilityClassConstructor"/><module name="InterfaceIsType"/><module name="VisibilityModifier"/><!-- Miscellaneous other checks.                   --><!-- See http://checkstyle.sf.net/config_misc.html --><module name="ArrayTypeStyle"/><module name="FinalParameters"/><module name="TodoComment"><property name="severity" value="ignore"/></module><module name="UpperEll"/></module></module>

2.1 导入步骤

进入eclipse主界面。window>perferences 进入如下截图:

2.2 导入公司自定义规则文件

如下截图:

2.3 设置为默认规则

确认设置规则:

3. 开始使用checkstyle

在eclipse工程项目右键如下图:

4. 打开checkstyle视图

5.效果报告列表和图

图:

6.规范校验及使用

结合公司制定的java代码规范文档和自定义规则文件使用。后续不断完善xdja_checkstyle.xml 规则文件。

转载于:https://my.oschina.net/zzuqiang/blog/835612

checkstyle安装使用相关推荐

  1. Eclipse插件CheckStyle的安装和使用

    转载自:http://www.cnblogs.com/lanxuezaipiao/p/3202169.html CheckStyle是SourceForge下的一个项目,提供了一个帮助JAVA开发人员 ...

  2. 作业2.1.1 安装并使用CheckStyle

    一.checkstyle安装与使用 (一)checkstyle的安装 - 在线安装 1. 打开Eclipse, 选择 help - install new software 2.在弹出的install ...

  3. eclipse 离线安装checkStyle

                                          CheckStyle 安装 在网上看了很多博客.博客写的大多是在线安装的方式,但是在国内在线安装最大的问题就是网络.很多时候 ...

  4. 玩物得志Java笔试题_代码规范利器-CheckStyle

    本期内容分为五个部分,阅读时长预估7分钟: 使用背景 CheckStyle使用意义 CheckStyle安装与使用 CheckStyle检查配置示例 落地使用情况及效果 使用背景 玩物得志目前还处在一 ...

  5. 代码规范工具-Checkstyle使用手册

    前段时间中心需要对外包的项目进行代码质量管理,所以在此对前段时间的工作做下总结. 现在很多开源工具都可以对代码进行规范审核,比较流行的有以下几款,大致给个简单介绍. PMD:是一款采用BSD协议发布的 ...

  6. Jenkins 在 Tomcat 中的部署及代码静态检查工具集成

    Jenkins 的简单部署 在安装了 Jenkins 运行所需的依赖(主要是 JDK)之后,可以通过如下步骤简单快速地部署 Jenkins: 下载 Jenkins. 打开终端并切换至下载目录. 运行命 ...

  7. SpringCloud工作笔记076--- CheckStyle插件提高java代码质量

    技术交流QQ群[JAVA,.NET,BigData,AI]:170933152 这个是eclipse中的,在idea中也有这个插件,需要的时候去看看装上吧. 国外的客户一般比较严谨,这些工作,甚至自己 ...

  8. Jenkins CI服务器搭建及Maven私服Nexus

    Jenkins CI服务器搭建及Maven私服Nexus 一:Jenkins持续集成(CI)1 1.1:Jenkins简介及特性1 1.2:Jenkins安装1 1.3:Jenkins配置1 1.4: ...

  9. IDEA上安装和使用checkstyle,findbugs,visualVM,PMD插件

    ##安装插件步骤: 1.打开settings 2.选择plugins 3.点击"Browse repositories" 4.搜索对应内插件,点击"install&quo ...

最新文章

  1. illegal base64 character 3a_双11华硕多款产品再送豪礼 高端硬件通吃最新3A大作
  2. 第 3 章 Keystone - 018 - 理解 Keystone 核心概念
  3. Oracle海量数据优化-01分区的渊源
  4. c语言字符串67ASDSff,(指针编程题目.doc
  5. 2017年你会花钱在线听歌吗?
  6. CCNA 实验三 3.2 2 默认路由
  7. 关于perl中DBD for Oracle的安装
  8. 两个具有相同的名称在CLASSPATH中的类
  9. hibernate merge saveorupdate save lock
  10. 收藏 | 3D目标检测综述:从数据集到2D和3D方法
  11. java 读取excel 文件 Unable to recognize OLE stream 错误
  12. Session和EL表达式实现登陆验证
  13. ENVI入门系列教程---一、数据预处理---2.2 编辑图像头文件
  14. paper 63 :函数比较:imfilter与fspecial
  15. PDFMiner 操作 PDF 文件
  16. html做彩色方格,超级炫酷,美图秀秀制作超漂亮彩色格子字图文教程
  17. Android Q安全锁屏下进入google photos不弹bouncer界面
  18. winform datagridview 没有出现垂直滚动条 上下_木门安装中出现问题如何解决?
  19. 紫杉醇人血清白蛋白纳米粒PTX-HSA|阿霉素卵清白蛋白纳米粒DOX-OVA|顺铂小鼠血清白蛋白纳米粒CDDP-MSA(试剂)
  20. inspect的使用

热门文章

  1. 16 条 yyds 的代码规范
  2. JDK9,像Unix脚本一样执行Java代码
  3. 关于 CPU 的一些基本知识总结
  4. PyTorch Cookbook(常用代码合集)
  5. AI十级「找茬」选手,非这个书生莫属,节后开源!
  6. 算法面试不懂技巧,你纯属被刷
  7. 读硕/博期间你积累了哪些重要的科研经验?
  8. 论文被scoop(抢先发表)是怎样一种体验?
  9. Fast-SCNN的解释以及使用Tensorflow 2.0的实现
  10. 经验 | 图像分割的实用技巧