目录
一、安装CheckStyle
1、依次访问IDEA >> File >> Settings >> Plugins >> Marketplace,点击CheckStyle-IDEA的Install按钮进行安装。
2、安装完成需重启IDEA。
二、配置CheckStyle
1、本地生成E:\rules\CheckStyle\checkstyle.xml文件
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
<module name="Checker">
<!--
If you set the basedir property below, then all reported file
names will be relative to the specified directory. See
http://checkstyle.sourceforge.net/config.html#Checker
<property name="basedir" value="${basedir}"/>
-->
<metadata name="com.atlas-sw.eclipse" value="I like Sydney"/>
<!--property name="cacheFile" value="${checkstyle.cache.file}" -->
<property name="severity" value="error"/>
<property name="fileExtensions" value="java, properties, xml, vm, g, g4, dtd"/>
<!-- BeforeExecutionFileFilters is required for sources that are based on java9 -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$" />
</module>
<!-- Filters -->
<module name="SeverityMatchFilter">
<!-- report all violations except ignore -->
<property name="severity" value="ignore"/>
<property name="acceptOnMatch" value="false"/>
</module>
<module name="SuppressionFilter">
<property name="file" value="${checkstyle.suppressions.file}"/>
</module>
<!-- Headers -->
<module name="Header">
<!--property name="headerFile" value="${checkstyle.header.file}" -->
<property name="fileExtensions" value="java"/>
<property name="id" value="header"/>
</module>
<module name="RegexpHeader">
<!--property name="headerFile" value="${checkstyle.regexp.header.file}" -->
<property name="fileExtensions" value="java"/>
</module>
<!-- Javadoc Comments -->
<!--
<module name="JavadocPackage">
<property name="allowLegacy" value="false"/>
</module>
-->
<!-- Miscellaneous -->
<!-- Regexp -->
<module name="RegexpSingleline">
<property name="format" value="^(?!(.*http|import)).{120,}$"/>
<property name="fileExtensions" value="g, g4"/>
<property name="message" value="Line should not be longer then 100 symbols"/>
</module>
<module name="RegexpOnFilename">
<property name="folderPattern" value="[\\/]src[\\/]xdocs[\\/]"/>
<property name="fileNamePattern" value="\.(xml)|(vm)$"/>
<property name="match" value="false"/>
<message key="regexp.filepath.mismatch" value="All files in the ''src/xdocs'' folder should have the ''xml'' or ''vm'' extension."/>
</module>
<module name="RegexpOnFilename">
<property name="folderPattern" value="[\\/]src[\\/]it[\\/]java[\\/]"/>
<property name="fileNamePattern" value="^((\w+Test)|(Abstract\w+))\.java$"/>
<property name="match" value="false"/>
<message key="regexp.filepath.mismatch" value="All files in the ''src/it/java'' folder should be named ''*Test.java'' or ''Abstract*.java''."/>
</module>
<!-- Size Violations -->
<module name="FileLength">
<!-- <property name="fileExtensions" value="java"/>-->
<property name="max" value="1500"/>
</module>
<!-- Whitespace -->
<module name="FileTabCharacter">
<property name="eachLine" value="false"/>
</module>
<module name="TreeWalker">
<property name="tabWidth" value="4"/>
<!-- Annotations -->
<module name="AnnotationLocation">
<property name="tokens" value="ANNOTATION_DEF"/>
<property name="tokens" value="ANNOTATION_FIELD_DEF"/>
<property name="allowSamelineSingleParameterlessAnnotation" value="false"/>
</module>
<module name="AnnotationLocation">
<property name="tokens" value="PARAMETER_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="AnnotationOnSameLine">
<!-- we can not use it as it conflicts with AnnotationLocation -->
<property name="severity" value="ignore"/>
<property name="tokens" value="METHOD_DEF"/>
<property name="tokens" value="CTOR_DEF"/>
<property name="tokens" value="TYPECAST"/>
<property name="tokens" value="DOT"/>
<property name="tokens" value="CLASS_DEF"/>
<property name="tokens" value="ENUM_DEF"/>
<property name="tokens" value="INTERFACE_DEF"/>
<property name="tokens" value="TYPE_ARGUMENT"/>
<property name="tokens" value="ANNOTATION_DEF"/>
<property name="tokens" value="LITERAL_NEW"/>
<property name="tokens" value="LITERAL_THROWS"/>
<property name="tokens" value="VARIABLE_DEF"/>
<property name="tokens" value="PARAMETER_DEF"/>
<property name="tokens" value="IMPLEMENTS_CLAUSE"/>
<property name="tokens" value="ANNOTATION_FIELD_DEF"/>
</module>
<module name="AnnotationUseStyle"/>
<module name="MissingDeprecated"/>
<module name="MissingOverride">
<property name="javaFiveCompatibility" value="true"/>
</module>
<module name="PackageAnnotation"/>
<!-- Block Checks -->
<module name="AvoidNestedBlocks">
<property name="allowInSwitchCase" value="true"/>
</module>
<module name="EmptyBlock">
<property name="tokens" value="LITERAL_CATCH"/>
<property name="tokens" value="ARRAY_INIT"/>
<property name="tokens" value="LITERAL_DEFAULT"/>
<property name="tokens" value="LITERAL_CASE"/>
<property name="tokens" value="INSTANCE_INIT"/>
<property name="tokens" value="LITERAL_DO"/>
<property name="tokens" value="LITERAL_ELSE"/>
<property name="tokens" value="LITERAL_FINALLY"/>
<property name="tokens" value="LITERAL_FOR"/>
<property name="tokens" value="LITERAL_IF"/>
<property name="tokens" value="LITERAL_SWITCH"/>
<property name="tokens" value="LITERAL_SYNCHRONIZED"/>
<property name="tokens" value="LITERAL_TRY"/>
<property name="tokens" value="LITERAL_WHILE"/>
<property name="tokens" value="STATIC_INIT"/>
<property name="option" value="text"/>
</module>
<module name="EmptyCatchBlock"/>
<module name="NeedBraces"/>
<module name="NeedBraces">
<property name="tokens" value="LAMBDA"/>
<property name="allowSingleLineStatement" value="true"/>
</module>
<module name="RightCurly">
<property name="option" value="alone" />
</module>
<!-- Class Design -->
<module name="FinalClass"/>
<module name="InnerTypeLast"/>
<module name="InterfaceIsType"/>
<module name="OneTopLevelClass"/>
<!-- Coding -->
<module name="CovariantEquals"/>
<module name="DefaultComesLast"/>
<module name="EmptyStatement"/>
<module name="EqualsAvoidNull"/>
<module name="EqualsHashCode"/>
<module name="IllegalInstantiation">
<property name="classes" value="org.xml.sax.SAXException, org.xml.sax.SAXParseException, org.apache.commons.beanutils.ConversionException,
org.antlr.v4.runtime.misc.ParseCancellationException, antlr.RecognitionException, antlr.TokenStreamException, antlr.TokenStreamRecognitionException, antlr.ANTLRException"/>
</module>
<module name="IllegalThrows"/>
<!--
<module name="IllegalToken">
<property name="tokens" value="LABELED_STAT"/>
<property name="tokens" value="LITERAL_NATIVE"/>
<property name="tokens" value="LITERAL_VOLATILE"/>
<property name="tokens" value="LITERAL_ASSERT"/>
</module>
-->
<module name="IllegalTokenText"/>
<module name="IllegalType">
<property name="illegalClassNames" value=""/>
</module>
<module name="InnerAssignment"/>
<module name="MissingCtor">
<!--
we will not use that fanatic validation, extra code is not good
But this Check will exists as it was created by community demand.
-->
<property name="severity" value="ignore"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="ModifiedControlVariable"/>
<module name="MultipleVariableDeclarations"/>
<module name="NestedForDepth">
<property name="max" value="2"/>
</module>
<module name="NestedIfDepth">
<property name="max" value="5" />
</module>
<module name="NestedTryDepth">
<property name="max" value="2" />
</module>
<module name="NoFinalizer"/>
<module name="OneStatementPerLine"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StringLiteralEquality"/>
<module name="SuperClone"/>
<module name="SuperFinalize"/>
<!-- Filters-->
<module name="SuppressionCommentFilter">
<!--
Use suppressions.xml for suppressions, this is only example.
checkFormat will prevent suppression comments from being valid.
-->
<property name="checkFormat" value="IGNORETHIS"/>
<property name="offCommentFormat" value="CSOFF\: .*"/>
<property name="onCommentFormat" value="CSON\: .*"/>
</module>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="-@cs\[(\w{8,}(\|\w{8,})*)\] \w[\(\)\-\.\'\`\,\:\;\w ]{10,}"/>
<property name="checkFormat" value="$1"/>
<property name="influenceFormat" value="3"/>
</module>
<!-- Imports -->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<!--
<module name="ImportOrder">
<property name="groups" value="/^javax?\./,org,/./,/^com\.(ztesoft|publicmobile)\./" />
<property name="ordered" value="true" />
<property name="separated" value="true" />
<property name="option" value="above" />
</module>
-->
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<!-- Javadoc Comments -->
<!--
<module name="AtclauseOrder"/>
<module name="JavadocMethod">
<property name="allowUndeclaredRTE" value="true"/>
<property name="allowThrowsTagsForSubclasses" value="true"/>
<property name="allowMissingPropertyJavadoc" value="true"/>
</module>
<module name="JavadocParagraph"/>
<module name="JavadocStyle">
<property name="scope" value="public"/>
</module>
<module name="JavadocTagContinuationIndentation"/>
<module name="JavadocType">
<property name="authorFormat" value="\S"/>
<property name="allowUnknownTags" value="true"/>
</module>
<module name="JavadocVariable"/>
<module name="NonEmptyAtclauseDescription"/>
<module name="SingleLineJavadoc"/>
<module name="WriteTag"/>
<module name="SummaryJavadoc"/>
-->
<!-- Metrics -->
<module name="BooleanExpressionComplexity">
<property name="max" value="7"/>
</module>
<!-- Misc -->
<module name="ArrayTypeStyle"/>
<module name="AvoidEscapedUnicodeCharacters">
<property name="allowIfAllCharactersEscaped" value="true"/>
</module>
<module name="DescendantToken"/>
<module name="FinalParameters">
<!--
we will not use that fanatic validation, extra modifiers pollute a code
it is better to use extra validation(Check) that argument is reassigned
But this Check will exists as it was created by community demand.
-->
<property name="severity" value="ignore"/>
</module>
<module name="OuterTypeFilename"/>
<!-- Modifiers -->
<module name="ModifierOrder"/>
<module name="ClassTypeParameterName"/>
<module name="InterfaceTypeParameterName"/>
<module name="LocalFinalVariableName"/>
<module name="MethodName"/>
<module name="MethodTypeParameterName"/>
<module name="PackageName"/>
<module name="StaticVariableName">
<property name="format" value="^(id)|([a-z][a-z0-9][a-zA-Z0-9]+)$"/>
</module>
<module name="TypeName"/>
<module name="RegexpSinglelineJava">
<property name="format" value="(System\.(((out|err)\.print(ln)?)|exit)\()|(\.printStackTrace\(\))" />
<property name="ignoreComments" value="true" />
<property name="message" value="avoid use system.out(err,exit) or printStackTrace()" />
</module>
<module name="OuterTypeNumber"/>
<module name="ParameterNumber">
<property name="severity" value="warning" />
<property name="max" value="10" />
</module>
<!-- Whitespace -->
<module name="EmptyForInitializerPad"/>
<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<module name="NoLineWrap"/>
<module name="NoWhitespaceBefore"/>
<module name="NoWhitespaceAfter" />
<module name="ParenPad"/>
<module name="SeparatorWrap">
<property name="tokens" value="DOT"/>
<property name="tokens" value="AT"/>
<property name="tokens" value="METHOD_REF"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap">
<property name="tokens" value="COMMA"/>
<property name="tokens" value="RBRACK"/>
<property name="tokens" value="ARRAY_DECLARATOR"/>
<property name="tokens" value="ELLIPSIS"/>
<property name="tokens" value="SEMI"/>
<property name="option" value="EOL"/>
</module>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
</module>
<module name="SuppressionFilter">
<property name="file" value="suppressions.xml"/>
</module>
</module>
2、本地生成E:\rules\CheckStyle\suppressions.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<!-- BSS -->
<!-- DEV1 -->
<!-- BC一次性算费中使用到的python相关 -->
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\bizcommon\\fc\\rating\\ratingcall\\ratingengine\\common\\python"/>
<!-- BC历史遗留代码,之前放在流程中屏蔽,现在放到例外文件中 -->
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\product\\price\\bll\\PricePlanManager.java"/>
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\product\\price\\servlet\\PricePlanExportServlet.java"/>
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\profile\\cdr\\bll\\Eval.java"/>
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\profile\\cust\\bs\\FileOperationManager.java"/>
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\res\\dao\\abstractimpl\\AccNbrExDAO.java"/>
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\bizcommon\\rating\\common\\python\\PythonEvent.java"/>
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\bizcommon\\rating\\common\\python\\PythonCall.java"/>
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\bizcommon\\rating\\common\\python\\IPythonEvent.java"/>
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\bizcommon\\rating\\common\\python\\EventAttr.java"/>
<!-- VIETICS使用到的python相关 -->
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\vietics\\common\\rating\\PythonEventVietics.java"/>
<!-- PRM使用到的python相关 -->
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\prm\\rating\\domain\\event\\JythonEvent.java"/>
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\prm\\rating\\domain\\event\\EventAttr.java"/>
<!-- BL欠费规则,话单查询,文件托收相关,类或者方法超长,有项目使用不易修改 -->
<suppress checks="FileLength|MethodLength" files="\\com\\ztesoft\\zsmart\\bss\\billing\\common\\dao\\abstractimpl\\AccountQueryDAO.java"/>
<suppress checks="FileLength|NestedIfDepth" files="\\com\\ztesoft\\zsmart\\bss\\billing\\common\\bll\\AccountQuery.java"/>
<suppress checks="FileLength|MethodLength" files="\\com\\ztesoft\\zsmart\\bss\\billing\\common\\bll\\ARFileDealMgr.java"/>
<suppress checks="FileLength" files="\\com\\ztesoft\\zsmart\\bss\\billing\\setup\\bll\\DebitManagerRule.java"/>
<suppress checks="FileLength" files="\\com\\ztesoft\\zsmart\\bss\\billing\\collection\\bll\\DebitManagerEngine.java"/>
<suppress checks="FileLength" files="\\com\\ztesoft\\zsmart\\bss\\billing\\chrg\\bll\\BillingFlowMonitor.java"/>
<!-- FBF 类或者方法超长,不易修改 -->
<suppress checks="FileLength|MethodLength" files="\\com\\ztesoft\\zsmart\\bfm\\dao\\impl\\EntityMetadataFactory.java"/>
<suppress checks="FileLength" files="\\com\\ztesoft\\zsmart\\bfm\dao\\impl\\ProductDaoTemplate.java"/>
<suppress checks="FileLength|MethodLength" files="\\com\\ztesoft\\zsmart\\bfm\\dao\\impl\\SimpleDaoTemplate.java"/>
<suppress checks="MethodName" files="\\com\\ztesoft\\zsmart\\bfm\\el\\ELInput.java"/>
<suppress checks="MethodName" files="\\com\\ztesoft\\zsmart\\bfm\\el\\ElFunctions.java"/>
<suppress checks="FileLength" files="\\com\\ztesoft\\zsmart\\bfm\\rule\\dao\\oracleimpl\\RuleDataDAOOracle.java"/>
<suppress checks="FileLength" files="\\com\\ztesoft\\zsmart\\bfm\\rule\\services\\RuleDataService.java"/>
<suppress checks="PackageName" files="\\com\\ztesoft\\zsmart\\bfm\\sessionMonitor\\SessionMonitorService.java"/>
<suppress checks="FileLength" files="\\com\\ztesoft\\zsmart\\bss\\busiorder\\dao\\abstractimpl\\WfWorkOrderDAO.java"/>
<suppress checks="FileLength|NestedIfDepth|NestedForDept" files="\\com\\ztesoft\\zsmart\\bss\\common\\config\\bll\\BusiConfigurationFactory.java"/>
<suppress checks="StaticVariableName" files="\\com\\ztesoft\\zsmart\\bss\\common\\export\\util\\DataFormatUtil.java"/>
<suppress checks="FileLength|MethodLength|NestedIfDepth" files="\\com\\ztesoft\\zsmart\\bss\\common\\utils\\BoUtil.java"/>
<suppress checks="FileLength" files="\\com\\ztesoft\\zsmart\\bss\\common\\utils\\BusiBaseDAO.java"/>
<suppress checks="FileLength" files="\\com\\ztesoft\\zsmart\\bfm\\dao\\impl\\ProductDaoTemplate.java"/>
<suppress checks="RegexpSinglelineJava" files="\\org\\aopalliance\\aop\\AspectException.java"/>
<suppress checks="MethodName" files="\\com\\ztesoft\\zsmart\\bfm\\pojorule\\util\\PojoELInput.java" />
<!-- DEV2 DEV5,在用的项目存在较多的形如“基类_事件”的类名,不易修改 -->
<suppress checks="TypeName" files="\\profile\\lifecycle.*\\bll\\scanner\\.*_.*java" />
<!-- DEV2 -->
<!-- 已经在用的项目,命名空间被定义为大写了,无法再修改 -->
<suppress checks="PackageName" files="\\(irantamin|mneTelenor|portuZAPP|canadaPMI|mauriMTML|kenyaYu|vanuatuFT|haitiViettel)" />
<!-- report包属框架代码,很多商用版本调用,无法修改函数,变量,包等命名规范问题-->
<suppress checks="PackageName|TypeName|MethodName|MemberName|StaticVariableName" files="com\\ztesoft\\zsmart\\report\\.*\.java" />
<suppress checks="TypeName" files="\\com\\ztesoft\\zsmart\\bss\\contact\\dispatch\\mml\\services\\BuildMMLRetCode_Desc.java" />
<!-- 自服务项目的代码不需要检查 -->
<suppress checks="" files="\\customer_selfservice\\(Fiji|irantamin|Mongolia|myanmar)" />
<suppress checks="" files="\\(custselfservice_mauriMTML|mobileselfservice)" />
<!-- DEV4 -->
<!-- 定义静态变量与配置文件保持一致,不适用驼峰命名法 -->
<suppress checks="StaticVariableName" files="BillGenerateCfg\.java" />
<suppress checks="StaticVariableName" files="ReportJobConfig\.java" />
<!-- MainServlet.java customreport项目启动时调用,需要在控制台打印启动成功信息 -->
<suppress checks="RegexpSinglelineJava" files="\\customreport\\servlet\\MainServlet\.java" />
<!-- BaseBillCtrl.java report启动批量打印账单进程需要提示信息,需要在控制台打信息 -->
<suppress checks="RegexpSinglelineJava" files="BaseBillCtrl\.java" />
<suppress checks="RegexpSinglelineJava" files="\\report\\printqry\\bll\\BatchBillPrint\.java" />
<!-- 从三方jar包拷过来的,用来与ireport整合的,不好修改 -->
<suppress checks="ParameterNumber" files="\\report\\util" />
<!-- DEV5 -->
<!-- 已经在用的项目,命名空间被定义为大写了,无法再修改 -->
<suppress checks="PackageName" files="\\(Common|angolaMvl|sTel)" />
<!-- DEV10 -->
<suppress checks="TypeName" files="\\com\\ztesoft\\provisioning\\.*_Stub\.java" />
<suppress checks="TypeName" files="\\com\\ztesoft\\zsmart\\smc\\.+\\.*_.*\.java" />
<suppress checks="" files="\\com\\ztesoft\\provisioning\\protocols\\webservice" />
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\provisioning\\webPublic\\comverseIn" />
<!-- DEV13 -->
<!-- 调用flex工具线程不退出,暂时只能用System.exit(-1) -->
<suppress checks="RegexpSinglelineJava" files="\\DailyCIApp.java" />
<!-- webservice -->
<!-- WebServices.java中不能识别自定义的异常[bss/ws/common/WebServiceException.java] -->
<suppress checks="RedundantThrows" files="\\com\\ztesoft\\zsmart\\bss\\ws\\.*\\WebServices.*.java" />
<suppress checks="RedundantThrows" files="\\com\\ztesoft\\zsmart\\bss\\ws\\.*\\ServiceSoap.*.java" />
<!-- portal下的ws -->
<suppress checks="" files="com\\publicmobile\\services" />
<!-- webservice客户端代码,不检查 -->
<suppress checks="" files="\\ws[Cc]lient" />
<suppress checks="" files="\\wsMelletClient" />
<suppress checks="" files="\\client[Dd]river" />
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\sfa\\common\\wsclient" />
<!-- 使用wsdl生成的代码-->
<suppress checks="MethodName" files="\\ocswebservices\\src\\com\\ztesoft\\ocsws\\services\\.*java" />
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\ws\\customization\\" />
<!-- ebs项目 -->
<suppress checks="" files="(SendSMSSvcServiceStub|CSVAllTests|CsvReader|CsvWriter)\.java" />
<suppress checks="" files="ws\\oppstage\\sobject\\Opportunity\.java" />
<!-- v8 开通 -->
<suppress checks="" files="com\\ztesoft\\zsmart\\provisioning\\core\\helpers\\CsvReader.java"/>
<suppress checks="" files="com\\ztesoft\\zsmart\\provisioning\\core\\ipc\\transport\\rmi\\RmiBusiService_Stub.java"/>
<suppress checks="" files="com\\ztesoft\\zsmart\\provisioning\\core\\monitor\\rmi\\RemoteMonitor_Stub.java"/>
<suppress checks="RegexpSinglelineJava" files="com\\ztesoft\\zsmart\\provisioning\\core\\starter\\ServiceActiveRun.java"/>
<suppress checks="RegexpSinglelineJava" files="com\\ztesoft\\zsmart\\provisioning\\core\\starter\\WorkFLowEngineRun.java"/>
<suppress checks="" files="com\\ztesoft\\zsmart\\provisioning\\core\\northadapter\\StandardOrder_3rdParty.xml"/>
<suppress checks="" files="com\\ztesoft\\zsmart\\provisioning\\plugins\\sa\\dataaccesses\\support\\synchronalaccess\\SynchronalRequest_Stub.java"/>
<suppress checks="FileLength" files="\\com\\ztesoft\\zsmart\\bss\\cc\\abe\\order\\OrderItem.java"/>
<suppress checks="FileLength" files="\\com\\ztesoft\\zsmart\\bss\\res\\bll\\FileOperationAccNbrManager.java"/>
<!-- PRM -->
<suppress checks="MethodName" files="\\com\\ztesoft\\zsmart\\bss\\prm\\rating\\price\\EventAttr.java"/>
<suppress checks="MethodName" files="\\com\\ztesoft\\zsmart\\bss\\prm\\rating\\price\\JythonEvent.java"/>
<!-- Base64 code-->
<suppress checks="" files="\\com\\ztesoft\\zsmart\\bss\\common\\helper\\Base64Kpn.java"/>
<suppress checks="" files="\\spring\\EngineConfig.xml"/>
<suppress checks="" files="\\.*\\mapper\\.*.xml"/>
<suppress checks="" files="\\.*\\.*.drl"/>
<suppress checks="" files="\\log.*.xml"/>
</suppressions>
3、开始配置:依次访问IDEA >> File >> Settings >> Tools >> checkStyle。
(1)选择Checkstyle verison的版本号为8.14;
(2)点击Configuration File下的 "+" 添加第1步生成的checkstyle.xml;
(3)点击Next;
(4)配置属性值为第2步生成的suppressions.xml;
(5)点击Next;
(6) 配置成功;
(7)点击Finish;
三、使用CheckStyle
1、 打开java类
2、点击开始Check按钮
3、生成错误信息