最近公司对代码要求严格了,要求代码要规范书写,因为不规范的代码往往会导致性能问题,维护困难问题,以及服务器升级后,可能运行不了等问题。故我们有必要规范我们的代码,特别是针对一个组织或公司级别以及项目组而言,规范的代码往往可以避免很多不必要的问题,也可以提升代码阅读性,减少维护成本之类的。

为了能够快捷方便有效的在最短的时间内让同事们的代码尽快的往规范的书写方式上靠拢,我们特地找了些辅助代码规范检查的工具,下面我大致列举几种,具体的使用方法我就不写了,大家按照工具名字自己去百度下或者尝试使用下就知道工具的作用和用法了。

  • checkstyle插件检查java代码编写规范,如是否缺少注释,命名是否规范。
  • PMD检查工具,多余的代码会提示,不规范的写法也会提示。(支持检查java代码和js代码)
  • finding bugs缺陷查找工具。
如果你使用的是eclipse工具你可以到插件市场中去按插件名称去寻找相关插件,并进行下载安装,当然我们也可以通过百度的方式

先将插件下载下来然后通过link的方式集成的eclipse中去。具体操作方式我就不赘述了,大家自由发挥,也欢迎大家补充使用说明书和来NoteShare提问一起讨论,一起共享资源。

以下给出checkstyle的安装截图

java代码检查工具列表java代码检查工具列表java代码检查工具列表

安装完之后重启就可以在项目的右键菜单中找到对应的check菜单,然后在要检查的java包上点击右键菜单中的check等菜单即可进行代码检查。

以下是pmd工具安装

java代码检查工具列表java代码检查工具列表

PMD检查内容需要调整一下,附件是最新的检查项配置文件,打开eclipse后,操作步骤如下:
(1)window->preferences->PMD->Rule Configuration 
(2)勾选中Use global rule management (左上角) 
(3)选中所有的 rule ,并删除 
(4)点击“导入”按钮,选择 Import by Reference导入方式 
(5)选总 noteshare-pmd.xml 后全部导入 
(6)点“OK",然后弹出的框,选择 “NO” 
(7)选中所有的检查项,然后点击“OK” 

noteshare-pmd.xml的文档内容为:

<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         name="PMD-new"
         xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
   <description>PMD Plugin preferences rule set</description>
   <rule ref="rulesets/java/design.xml/AbstractClassWithoutAbstractMethod"/>
   <rule ref="rulesets/java/design.xml/AbstractClassWithoutAnyMethod"/>
   <rule ref="rulesets/java/naming.xml/AbstractNaming"/>
   <rule ref="rulesets/java/design.xml/AccessorClassGeneration"/>
   <rule ref="rulesets/java/strings.xml/AppendCharacterWithChar"/>
   <rule ref="rulesets/java/sunsecure.xml/ArrayIsStoredDirectly"/>
   <rule ref="rulesets/ecmascript/basic.xml/AssignmentInOperand"/>
   <rule ref="rulesets/java/controversial.xml/AssignmentInOperand"/>
   <rule ref="rulesets/java/design.xml/AssignmentToNonFinalStatic"/>
   <rule ref="rulesets/java/controversial.xml/AvoidAccessibilityAlteration"/>
   <rule ref="rulesets/java/optimizations.xml/AvoidArrayLoops"/>
   <rule ref="rulesets/java/migrating.xml/AvoidAssertAsIdentifier"/>
   <rule ref="rulesets/xsl/xpath.xml/AvoidAxisNavigation"/>
   <rule ref="rulesets/java/basic.xml/AvoidBranchingStatementAsLastInLoop"/>
   <rule ref="rulesets/java/finalizers.xml/AvoidCallingFinalize"/>
   <rule ref="rulesets/java/strictexception.xml/AvoidCatchingGenericException"/>
   <rule ref="rulesets/java/strictexception.xml/AvoidCatchingNPE"/>
   <rule ref="rulesets/java/strictexception.xml/AvoidCatchingThrowable"/>
   <rule ref="rulesets/java/design.xml/AvoidConstantsInterface"/>
   <rule ref="rulesets/java/basic.xml/AvoidDecimalLiteralsInBigDecimalConstructor"/>
   <rule ref="rulesets/apex/complexity.xml/AvoidDeeplyNestedIfStmts"/>
   <rule ref="rulesets/vm/basic.xml/AvoidDeeplyNestedIfStmts"/>
   <rule ref="rulesets/java/design.xml/AvoidDeeplyNestedIfStmts"/>
   <rule ref="rulesets/apex/performance.xml/AvoidDmlStatementsInLoops"/>
   <rule ref="rulesets/java/naming.xml/AvoidDollarSigns"/>
   <rule ref="rulesets/java/strings.xml/AvoidDuplicateLiterals"/>
   <rule ref="rulesets/java/migrating.xml/AvoidEnumAsIdentifier"/>
   <rule ref="rulesets/java/naming.xml/AvoidFieldNameMatchingMethodName"/>
   <rule ref="rulesets/java/naming.xml/AvoidFieldNameMatchingTypeName"/>
   <rule ref="rulesets/java/controversial.xml/AvoidFinalLocalVariable"/>
   <rule ref="rulesets/apex/style.xml/AvoidGlobalModifier"/>
   <rule ref="rulesets/java/design.xml/AvoidInstanceofChecksInCatchClause"/>
   <rule ref="rulesets/apex/style.xml/AvoidLogicInTrigger"/>
   <rule ref="rulesets/java/strictexception.xml/AvoidLosingExceptionInformation"/>
   <rule ref="rulesets/java/basic.xml/AvoidMultipleUnaryOperators"/>
   <rule ref="rulesets/java/controversial.xml/AvoidPrefixingMethodParameters"/>
   <rule ref="rulesets/java/logging-java.xml/AvoidPrintStackTrace"/>
   <rule ref="rulesets/java/design.xml/AvoidProtectedFieldInFinalClass"/>
   <rule ref="rulesets/java/design.xml/AvoidProtectedMethodInFinalClassNotExtending"/>
   <rule ref="rulesets/vm/basic.xml/AvoidReassigningParameters"/>
   <rule ref="rulesets/java/design.xml/AvoidReassigningParameters"/>
   <rule ref="rulesets/java/strictexception.xml/AvoidRethrowingException"/>
   <rule ref="rulesets/apex/performance.xml/AvoidSoqlInLoops"/>
   <rule ref="rulesets/java/design.xml/AvoidSynchronizedAtMethodLevel"/>
   <rule ref="rulesets/java/basic.xml/AvoidThreadGroup"/>
   <rule ref="rulesets/java/strictexception.xml/AvoidThrowingNewInstanceOfSameException"/>
   <rule ref="rulesets/java/strictexception.xml/AvoidThrowingNullPointerException"/>
   <rule ref="rulesets/java/strictexception.xml/AvoidThrowingRawExceptionTypes"/>
   <rule ref="rulesets/ecmascript/basic.xml/AvoidTrailingComma"/>
   <rule ref="rulesets/java/basic.xml/AvoidUsingHardCodedIP"/>
   <rule ref="rulesets/java/controversial.xml/AvoidUsingNativeCode"/>
   <rule ref="rulesets/java/basic.xml/AvoidUsingOctalValues"/>
   <rule ref="rulesets/java/controversial.xml/AvoidUsingShortType"/>
   <rule ref="rulesets/java/controversial.xml/AvoidUsingVolatile"/>
   <rule ref="rulesets/java/design.xml/BadComparison"/>
   <rule ref="rulesets/java/basic.xml/BigIntegerInstantiation"/>
   <rule ref="rulesets/java/naming.xml/BooleanGetMethodName"/>
   <rule ref="rulesets/java/basic.xml/BooleanInstantiation"/>
   <rule ref="rulesets/java/basic.xml/BrokenNullCheck"/>
   <rule ref="rulesets/java/migrating.xml/ByteInstantiation"/>
   <rule ref="rulesets/java/android.xml/CallSuperFirst"/>
   <rule ref="rulesets/java/controversial.xml/CallSuperInConstructor"/>
   <rule ref="rulesets/java/android.xml/CallSuperLast"/>
   <rule ref="rulesets/java/basic.xml/CheckResultSet"/>
   <rule ref="rulesets/java/basic.xml/CheckSkipResult"/>
   <rule ref="rulesets/java/basic.xml/ClassCastExceptionWithToArray"/>
   <rule ref="rulesets/java/naming.xml/ClassNamingConventions"/>
   <rule ref="rulesets/apex/style.xml/ClassNamingConventions"/>
   <rule ref="rulesets/java/design.xml/ClassWithOnlyPrivateConstructorsShouldBeFinal"/>
   <rule ref="rulesets/java/clone.xml/CloneMethodMustBePublic"/>
   <rule ref="rulesets/java/clone.xml/CloneMethodMustImplementCloneable"/>
   <rule ref="rulesets/java/clone.xml/CloneMethodReturnTypeMustMatchClassName"/>
   <rule ref="rulesets/java/clone.xml/CloneThrowsCloneNotSupportedException"/>
   <rule ref="rulesets/java/design.xml/CloseResource"/>
   <rule ref="rulesets/java/comments.xml/CommentContent"/>
   <rule ref="rulesets/java/comments.xml/CommentDefaultAccessModifier"/>
   <rule ref="rulesets/java/comments.xml/CommentRequired"/>
   <rule ref="rulesets/java/comments.xml/CommentSize"/>
   <rule ref="rulesets/java/design.xml/CompareObjectsWithEquals"/>
   <rule ref="rulesets/java/strings.xml/ConsecutiveAppendsShouldReuse"/>
   <rule ref="rulesets/java/strings.xml/ConsecutiveLiteralAppends"/>
   <rule ref="rulesets/ecmascript/basic.xml/ConsistentReturn"/>
   <rule ref="rulesets/java/design.xml/ConstantsInInterface"/>
   <rule ref="rulesets/java/design.xml/ConstructorCallsOverridableMethod"/>
   <rule ref="rulesets/java/coupling.xml/CouplingBetweenObjects"/>
   <rule ref="rulesets/plsql/codesize.xml/CyclomaticComplexity"/>
   <rule ref="rulesets/java/codesize.xml/CyclomaticComplexity"/>
   <rule ref="rulesets/java/design.xml/DefaultLabelNotLastInSwitchStmt"/>
   <rule ref="rulesets/java/controversial.xml/DefaultPackage"/>
   <rule ref="rulesets/java/controversial.xml/DoNotCallGarbageCollectionExplicitly"/>
   <rule ref="rulesets/java/j2ee.xml/DoNotCallSystemExit"/>
   <rule ref="rulesets/java/strictexception.xml/DoNotExtendJavaLangError"/>
   <rule ref="rulesets/java/android.xml/DoNotHardCodeSDCard"/>
   <rule ref="rulesets/java/strictexception.xml/DoNotThrowExceptionInFinally"/>
   <rule ref="rulesets/java/j2ee.xml/DoNotUseThreads"/>
   <rule ref="rulesets/java/basic.xml/DontCallThreadRun"/>
   <rule ref="rulesets/java/imports.xml/DontImportJavaLang"/>
   <rule ref="rulesets/java/controversial.xml/DontImportSun"/>
   <rule ref="rulesets/jsp/basic-jsf.xml/DontNestJsfInJstlIteration"/>
   <rule ref="rulesets/java/basic.xml/DontUseFloatTypeForLoopIndices"/>
   <rule ref="rulesets/java/basic.xml/DoubleCheckedLocking"/>
   <rule ref="rulesets/java/imports.xml/DuplicateImports"/>
   <rule ref="rulesets/jsp/basic.xml/DuplicateJspImports"/>
   <rule ref="rulesets/java/empty.xml/EmptyCatchBlock"/>
   <rule ref="rulesets/java/finalizers.xml/EmptyFinalizer"/>
   <rule ref="rulesets/java/empty.xml/EmptyFinallyBlock"/>
   <rule ref="rulesets/vm/basic.xml/EmptyForeachStmt"/>
   <rule ref="rulesets/java/empty.xml/EmptyIfStmt"/>
   <rule ref="rulesets/vm/basic.xml/EmptyIfStmt"/>
   <rule ref="rulesets/java/empty.xml/EmptyInitializer"/>
   <rule ref="rulesets/java/design.xml/EmptyMethodInAbstractClassShouldBeAbstract"/>
   <rule ref="rulesets/java/empty.xml/EmptyStatementBlock"/>
   <rule ref="rulesets/java/empty.xml/EmptyStatementNotInLoop"/>
   <rule ref="rulesets/java/empty.xml/EmptyStaticInitializer"/>
   <rule ref="rulesets/java/empty.xml/EmptySwitchStatements"/>
   <rule ref="rulesets/java/empty.xml/EmptySynchronizedBlock"/>
   <rule ref="rulesets/java/empty.xml/EmptyTryBlock"/>
   <rule ref="rulesets/java/empty.xml/EmptyWhileStmt"/>
   <rule ref="rulesets/ecmascript/basic.xml/EqualComparison"/>
   <rule ref="rulesets/java/design.xml/EqualsNull"/>
   <rule ref="rulesets/java/strictexception.xml/ExceptionAsFlowControl"/>
   <rule ref="rulesets/apex/complexity.xml/ExcessiveClassLength"/>
   <rule ref="rulesets/java/codesize.xml/ExcessiveClassLength"/>
   <rule ref="rulesets/java/coupling.xml/ExcessiveImports"/>
   <rule ref="rulesets/plsql/codesize.xml/ExcessiveMethodLength"/>
   <rule ref="rulesets/java/codesize.xml/ExcessiveMethodLength"/>
   <rule ref="rulesets/plsql/codesize.xml/ExcessiveObjectLength"/>
   <rule ref="rulesets/plsql/codesize.xml/ExcessivePackageBodyLength"/>
   <rule ref="rulesets/plsql/codesize.xml/ExcessivePackageSpecificationLength"/>
   <rule ref="rulesets/plsql/codesize.xml/ExcessiveParameterList"/>
   <rule ref="rulesets/apex/complexity.xml/ExcessiveParameterList"/>
   <rule ref="rulesets/java/codesize.xml/ExcessiveParameterList"/>
   <rule ref="rulesets/apex/complexity.xml/ExcessivePublicCount"/>
   <rule ref="rulesets/java/codesize.xml/ExcessivePublicCount"/>
   <rule ref="rulesets/vm/basic.xml/ExcessiveTemplateLength"/>
   <rule ref="rulesets/plsql/codesize.xml/ExcessiveTypeLength"/>
   <rule ref="rulesets/java/basic.xml/ExtendsObject"/>
   <rule ref="rulesets/java/design.xml/FieldDeclarationsShouldBeAtStartOfClass"/>
   <rule ref="rulesets/java/design.xml/FinalFieldCouldBeStatic"/>
   <rule ref="rulesets/java/finalizers.xml/FinalizeDoesNotCallSuperFinalize"/>
   <rule ref="rulesets/java/finalizers.xml/FinalizeOnlyCallsSuperFinalize"/>
   <rule ref="rulesets/java/finalizers.xml/FinalizeOverloaded"/>
   <rule ref="rulesets/java/finalizers.xml/FinalizeShouldBeProtected"/>
   <rule ref="rulesets/java/basic.xml/ForLoopShouldBeWhileLoop"/>
   <rule ref="rulesets/java/braces.xml/ForLoopsMustUseBraces"/>
   <rule ref="rulesets/ecmascript/braces.xml/ForLoopsMustUseBraces"/>
   <rule ref="rulesets/java/naming.xml/GenericsNaming"/>
   <rule ref="rulesets/ecmascript/basic.xml/GlobalVariable"/>
   <rule ref="rulesets/java/logging-jakarta-commons.xml/GuardDebugLogging"/>
   <rule ref="rulesets/java/logging-java.xml/GuardLogStatementJavaUtil"/>
   <rule ref="rulesets/java/design.xml/IdempotentOperations"/>
   <rule ref="rulesets/java/braces.xml/IfElseStmtsMustUseBraces"/>
   <rule ref="rulesets/ecmascript/braces.xml/IfElseStmtsMustUseBraces"/>
   <rule ref="rulesets/java/braces.xml/IfStmtsMustUseBraces"/>
   <rule ref="rulesets/ecmascript/braces.xml/IfStmtsMustUseBraces"/>
   <rule ref="rulesets/jsp/basic.xml/IframeMissingSrcAttribute"/>
   <rule ref="rulesets/java/design.xml/ImmutableField"/>
   <rule ref="rulesets/java/imports.xml/ImportFromSamePackage"/>
   <rule ref="rulesets/java/strings.xml/InefficientEmptyStringCheck"/>
   <rule ref="rulesets/java/strings.xml/InefficientStringBuffering"/>
   <rule ref="rulesets/ecmascript/basic.xml/InnaccurateNumericLiteral"/>
   <rule ref="rulesets/java/design.xml/InstantiationToGetClass"/>
   <rule ref="rulesets/java/strings.xml/InsufficientStringBufferDeclaration"/>
   <rule ref="rulesets/java/migrating.xml/IntegerInstantiation"/>
   <rule ref="rulesets/pom/basic.xml/InvalidDependencyTypes"/>
   <rule ref="rulesets/java/logging-java.xml/InvalidSlf4jMessageFormat"/>
   <rule ref="rulesets/java/migrating.xml/JUnit4SuitesShouldUseSuiteAnnotation"/>
   <rule ref="rulesets/java/migrating.xml/JUnit4TestShouldUseAfterAnnotation"/>
   <rule ref="rulesets/java/migrating.xml/JUnit4TestShouldUseBeforeAnnotation"/>
   <rule ref="rulesets/java/migrating.xml/JUnit4TestShouldUseTestAnnotation"/>
   <rule ref="rulesets/java/junit.xml/JUnitAssertionsShouldIncludeMessage"/>
   <rule ref="rulesets/java/junit.xml/JUnitSpelling"/>
   <rule ref="rulesets/java/junit.xml/JUnitStaticSuite"/>
   <rule ref="rulesets/java/junit.xml/JUnitTestContainsTooManyAsserts"/>
   <rule ref="rulesets/java/junit.xml/JUnitTestsShouldIncludeAssert"/>
   <rule ref="rulesets/java/migrating.xml/JUnitUseExpected"/>
   <rule ref="rulesets/jsp/basic.xml/JspEncoding"/>
   <rule ref="rulesets/java/basic.xml/JumbledIncrementer"/>
   <rule ref="rulesets/java/j2ee.xml/LocalHomeNamingConvention"/>
   <rule ref="rulesets/java/j2ee.xml/LocalInterfaceSessionNamingConvention"/>
   <rule ref="rulesets/java/logging-java.xml/LoggerIsNotStaticFinal"/>
   <rule ref="rulesets/java/design.xml/LogicInversion"/>
   <rule ref="rulesets/java/migrating.xml/LongInstantiation"/>
   <rule ref="rulesets/java/naming.xml/LongVariable"/>
   <rule ref="rulesets/java/coupling.xml/LooseCoupling"/>
   <rule ref="rulesets/java/coupling.xml/LoosePackageCoupling"/>
   <rule ref="rulesets/java/j2ee.xml/MDBAndSessionBeanNamingConvention"/>
   <rule ref="rulesets/java/naming.xml/MethodNamingConventions"/>
   <rule ref="rulesets/apex/style.xml/MethodNamingConventions"/>
   <rule ref="rulesets/java/sunsecure.xml/MethodReturnsInternalArray"/>
   <rule ref="rulesets/java/naming.xml/MethodWithSameNameAsEnclosingClass"/>
   <rule ref="rulesets/apex/style.xml/MethodWithSameNameAsEnclosingClass"/>
   <rule ref="rulesets/java/naming.xml/MisleadingVariableName"/>
   <rule ref="rulesets/java/basic.xml/MisplacedNullCheck"/>
   <rule ref="rulesets/java/design.xml/MissingBreakInSwitch"/>
   <rule ref="rulesets/java/javabeans.xml/MissingSerialVersionUID"/>
   <rule ref="rulesets/java/design.xml/MissingStaticMethodInNonInstantiatableClass"/>
   <rule ref="rulesets/xml/basic.xml/MistypedCDATASection"/>
   <rule ref="rulesets/java/codesize.xml/ModifiedCyclomaticComplexity"/>
   <rule ref="rulesets/java/logging-java.xml/MoreThanOneLogger"/>
   <rule ref="rulesets/plsql/codesize.xml/NPathComplexity"/>
   <rule ref="rulesets/java/codesize.xml/NPathComplexity"/>
   <rule ref="rulesets/apex/complexity.xml/NcssConstructorCount"/>
   <rule ref="rulesets/java/codesize.xml/NcssConstructorCount"/>
   <rule ref="rulesets/plsql/codesize.xml/NcssMethodCount"/>
   <rule ref="rulesets/apex/complexity.xml/NcssMethodCount"/>
   <rule ref="rulesets/java/codesize.xml/NcssMethodCount"/>
   <rule ref="rulesets/plsql/codesize.xml/NcssObjectCount"/>
   <rule ref="rulesets/apex/complexity.xml/NcssTypeCount"/>
   <rule ref="rulesets/java/codesize.xml/NcssTypeCount"/>
   <rule ref="rulesets/jsp/basic.xml/NoClassAttribute"/>
   <rule ref="rulesets/ecmascript/unnecessary.xml/NoElseReturn"/>
   <rule ref="rulesets/jsp/basic.xml/NoHtmlComments"/>
   <rule ref="rulesets/vm/basic.xml/NoInlineJavaScript"/>
   <rule ref="rulesets/jsp/basic.xml/NoInlineScript"/>
   <rule ref="rulesets/jsp/basic.xml/NoInlineStyleInformation"/>
   <rule ref="rulesets/vm/basic.xml/NoInlineStyles"/>
   <rule ref="rulesets/jsp/basic.xml/NoJspForward"/>
   <rule ref="rulesets/jsp/basic.xml/NoLongScripts"/>
   <rule ref="rulesets/java/naming.xml/NoPackage"/>
   <rule ref="rulesets/jsp/basic.xml/NoScriptlets"/>
   <rule ref="rulesets/jsp/basic.xml/NoUnsanitizedJSPExpression"/>
   <rule ref="rulesets/java/design.xml/NonCaseLabelInSwitchStatement"/>
   <rule ref="rulesets/java/design.xml/NonStaticInitializer"/>
   <rule ref="rulesets/java/design.xml/NonThreadSafeSingleton"/>
   <rule ref="rulesets/java/controversial.xml/NullAssignment"/>
   <rule ref="rulesets/java/controversial.xml/OneDeclarationPerLine"/>
   <rule ref="rulesets/java/design.xml/OptimizableToArrayCall"/>
   <rule ref="rulesets/java/basic.xml/OverrideBothEqualsAndHashcode"/>
   <rule ref="rulesets/java/naming.xml/PackageCase"/>
   <rule ref="rulesets/java/design.xml/PositionLiteralsFirstInCaseInsensitiveComparisons"/>
   <rule ref="rulesets/java/design.xml/PositionLiteralsFirstInComparisons"/>
   <rule ref="rulesets/java/optimizations.xml/PrematureDeclaration"/>
   <rule ref="rulesets/java/design.xml/PreserveStackTrace"/>
   <rule ref="rulesets/pom/basic.xml/ProjectVersionAsDependencyVersion"/>
   <rule ref="rulesets/java/clone.xml/ProperCloneImplementation"/>
   <rule ref="rulesets/java/logging-jakarta-commons.xml/ProperLogger"/>
   <rule ref="rulesets/java/optimizations.xml/RedundantFieldInitializer"/>
   <rule ref="rulesets/java/j2ee.xml/RemoteInterfaceNamingConvention"/>
   <rule ref="rulesets/java/j2ee.xml/RemoteSessionInterfaceNamingConvention"/>
   <rule ref="rulesets/java/migrating.xml/ReplaceEnumerationWithIterator"/>
   <rule ref="rulesets/java/migrating.xml/ReplaceHashtableWithMap"/>
   <rule ref="rulesets/java/migrating.xml/ReplaceVectorWithList"/>
   <rule ref="rulesets/java/design.xml/ReturnEmptyArrayRatherThanNull"/>
   <rule ref="rulesets/java/basic.xml/ReturnFromFinallyBlock"/>
   <rule ref="rulesets/ecmascript/basic.xml/ScopeForInVariable"/>
   <rule ref="rulesets/java/naming.xml/ShortClassName"/>
   <rule ref="rulesets/java/migrating.xml/ShortInstantiation"/>
   <rule ref="rulesets/java/naming.xml/ShortMethodName"/>
   <rule ref="rulesets/java/strictexception.xml/SignatureDeclareThrowsException"/>
   <rule ref="rulesets/java/design.xml/SimpleDateFormatNeedsLocale"/>
   <rule ref="rulesets/java/junit.xml/SimplifyBooleanAssertion"/>
   <rule ref="rulesets/java/design.xml/SimplifyBooleanExpressions"/>
   <rule ref="rulesets/java/design.xml/SimplifyBooleanReturns"/>
   <rule ref="rulesets/java/design.xml/SimplifyConditional"/>
   <rule ref="rulesets/java/optimizations.xml/SimplifyStartsWith"/>
   <rule ref="rulesets/java/design.xml/SingleMethodSingleton"/>
   <rule ref="rulesets/java/design.xml/SingletonClassReturningNewInstance"/>
   <rule ref="rulesets/java/design.xml/SingularField"/>
   <rule ref="rulesets/java/j2ee.xml/StaticEJBFieldShouldBeFinal"/>
   <rule ref="rulesets/apex/complexity.xml/StdCyclomaticComplexity"/>
   <rule ref="rulesets/java/codesize.xml/StdCyclomaticComplexity"/>
   <rule ref="rulesets/java/strings.xml/StringBufferInstantiationWithChar"/>
   <rule ref="rulesets/java/strings.xml/StringInstantiation"/>
   <rule ref="rulesets/java/strings.xml/StringToString"/>
   <rule ref="rulesets/java/naming.xml/SuspiciousConstantFieldName"/>
   <rule ref="rulesets/java/naming.xml/SuspiciousEqualsMethodName"/>
   <rule ref="rulesets/java/naming.xml/SuspiciousHashcodeMethodName"/>
   <rule ref="rulesets/java/controversial.xml/SuspiciousOctalEscape"/>
   <rule ref="rulesets/java/design.xml/SwitchDensity"/>
   <rule ref="rulesets/java/design.xml/SwitchStmtsShouldHaveDefault"/>
   <rule ref="rulesets/java/logging-java.xml/SystemPrintln"/>
   <rule ref="rulesets/plsql/dates.xml/TO_DATEWithoutDateFormat"/>
   <rule ref="rulesets/plsql/dates.xml/TO_DATE_TO_CHAR"/>
   <rule ref="rulesets/plsql/dates.xml/TO_TIMESTAMPWithoutDateFormat"/>
   <rule ref="rulesets/java/junit.xml/TestClassWithoutTestCases"/>
   <rule ref="rulesets/plsql/TomKytesDespair.xml/TomKytesDespair"/>
   <rule ref="rulesets/java/design.xml/TooFewBranchesForASwitchStatement"/>
   <rule ref="rulesets/plsql/codesize.xml/TooManyFields"/>
   <rule ref="rulesets/apex/complexity.xml/TooManyFields"/>
   <rule ref="rulesets/java/codesize.xml/TooManyFields"/>
   <rule ref="rulesets/plsql/codesize.xml/TooManyMethods"/>
   <rule ref="rulesets/java/codesize.xml/TooManyMethods"/>
   <rule ref="rulesets/java/imports.xml/TooManyStaticImports"/>
   <rule ref="rulesets/java/design.xml/UncommentedEmptyConstructor"/>
   <rule ref="rulesets/java/design.xml/UncommentedEmptyMethodBody"/>
   <rule ref="rulesets/java/basic.xml/UnconditionalIfStatement"/>
   <rule ref="rulesets/ecmascript/unnecessary.xml/UnnecessaryBlock"/>
   <rule ref="rulesets/java/junit.xml/UnnecessaryBooleanAssertion"/>
   <rule ref="rulesets/java/strings.xml/UnnecessaryCaseChange"/>
   <rule ref="rulesets/java/controversial.xml/UnnecessaryConstructor"/>
   <rule ref="rulesets/java/unnecessary.xml/UnnecessaryConversionTemporary"/>
   <rule ref="rulesets/java/unnecessary.xml/UnnecessaryFinalModifier"/>
   <rule ref="rulesets/java/imports.xml/UnnecessaryFullyQualifiedName"/>
   <rule ref="rulesets/java/design.xml/UnnecessaryLocalBeforeReturn"/>
   <rule ref="rulesets/java/controversial.xml/UnnecessaryParentheses"/>
   <rule ref="rulesets/ecmascript/unnecessary.xml/UnnecessaryParentheses"/>
   <rule ref="rulesets/java/unnecessary.xml/UnnecessaryReturn"/>
   <rule ref="rulesets/java/optimizations.xml/UnnecessaryWrapperObjectCreation"/>
   <rule ref="rulesets/ecmascript/basic.xml/UnreachableCode"/>
   <rule ref="rulesets/java/design.xml/UnsynchronizedStaticDateFormatter"/>
   <rule ref="rulesets/java/unusedcode.xml/UnusedFormalParameter"/>
   <rule ref="rulesets/java/imports.xml/UnusedImports"/>
   <rule ref="rulesets/java/unusedcode.xml/UnusedLocalVariable"/>
   <rule ref="rulesets/vm/basic.xml/UnusedMacroParameter"/>
   <rule ref="rulesets/java/unusedcode.xml/UnusedModifier"/>
   <rule ref="rulesets/java/unnecessary.xml/UnusedNullCheckInEquals"/>
   <rule ref="rulesets/java/unusedcode.xml/UnusedPrivateField"/>
   <rule ref="rulesets/java/unusedcode.xml/UnusedPrivateMethod"/>
   <rule ref="rulesets/java/optimizations.xml/UseArrayListInsteadOfVector"/>
   <rule ref="rulesets/java/optimizations.xml/UseArraysAsList"/>
   <rule ref="rulesets/java/junit.xml/UseAssertEqualsInsteadOfAssertTrue"/>
   <rule ref="rulesets/java/junit.xml/UseAssertNullInsteadOfAssertTrue"/>
   <rule ref="rulesets/java/junit.xml/UseAssertSameInsteadOfAssertTrue"/>
   <rule ref="rulesets/java/junit.xml/UseAssertTrueInsteadOfAssertEquals"/>
   <rule ref="rulesets/ecmascript/basic.xml/UseBaseWithParseInt"/>
   <rule ref="rulesets/java/design.xml/UseCollectionIsEmpty"/>
   <rule ref="rulesets/xsl/xpath.xml/UseConcatOnce"/>
   <rule ref="rulesets/java/logging-jakarta-commons.xml/UseCorrectExceptionLogging"/>
   <rule ref="rulesets/java/strings.xml/UseEqualsToCompareStrings"/>
   <rule ref="rulesets/java/strings.xml/UseIndexOfChar"/>
   <rule ref="rulesets/java/design.xml/UseNotifyAllInsteadOfNotify"/>
   <rule ref="rulesets/java/controversial.xml/UseObjectForClearerAPI"/>
   <rule ref="rulesets/java/j2ee.xml/UseProperClassLoader"/>
   <rule ref="rulesets/java/optimizations.xml/UseStringBufferForStringAppends"/>
   <rule ref="rulesets/java/strings.xml/UseStringBufferLength"/>
   <rule ref="rulesets/java/design.xml/UseUtilityClass"/>
   <rule ref="rulesets/java/design.xml/UseVarargs"/>
   <rule ref="rulesets/java/unnecessary.xml/UselessOperationOnImmutable"/>
   <rule ref="rulesets/java/unnecessary.xml/UselessOverridingMethod"/>
   <rule ref="rulesets/java/unnecessary.xml/UselessQualifiedThis"/>
   <rule ref="rulesets/java/strings.xml/UselessStringValueOf"/>
   <rule ref="rulesets/java/naming.xml/VariableNamingConventions"/>
   <rule ref="rulesets/apex/style.xml/VariableNamingConventions"/>
   <rule ref="rulesets/java/braces.xml/WhileLoopsMustUseBraces"/>
   <rule ref="rulesets/ecmascript/braces.xml/WhileLoopsMustUseBraces"/>
</ruleset>



以下是findbugs插件安装

java代码检查工具列表java代码检查工具列表


作者:星辰 时间:2016-09-27 浏览 841评论 0 赞 0砸 0 标签: eclipse 工具
评论
还可以再输入500个字

请您注意

·自觉遵守:爱国、守法、自律、真实、文明的原则
·尊重网上道德,遵守《全国人大常委会关于维护互联网安全的决定》及中华人民共和国其他各项有关法律法规
·严禁发表危害国家安全,破坏民族团结、国家宗教政策和社会稳定,含侮辱、诽谤、教唆、淫秽等内容的作品
·承担一切因您的行为而直接或间接导致的民事或刑事法律责任
·您在NoteShare上发表的作品,NoteShare有权在网站内保留、转载、引用或者删除
·参与本评论即表明您已经阅读并接受上述条款