From e43554190a743cea7edb8770b6601893a23815b8 Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Tue, 6 Nov 2012 15:57:14 +0100 Subject: [PATCH] SONAR-3934 Extract sonar-pmd-plugin into Sonar Java --- plugins/sonar-pmd-plugin/infinitest.args | 1 - plugins/sonar-pmd-plugin/infinitest.filters | 3 - plugins/sonar-pmd-plugin/pom.xml | 131 -- .../sonar/plugins/pmd/PmdConfiguration.java | 108 -- .../org/sonar/plugins/pmd/PmdConstants.java | 37 - .../org/sonar/plugins/pmd/PmdExecutor.java | 127 -- .../org/sonar/plugins/pmd/PmdLevelUtils.java | 47 - .../java/org/sonar/plugins/pmd/PmdPlugin.java | 43 - .../sonar/plugins/pmd/PmdProfileExporter.java | 154 -- .../sonar/plugins/pmd/PmdProfileImporter.java | 139 -- .../sonar/plugins/pmd/PmdRuleRepository.java | 52 - .../java/org/sonar/plugins/pmd/PmdSensor.java | 74 - .../org/sonar/plugins/pmd/PmdTemplate.java | 95 -- .../pmd/PmdUnitTestsRuleRepository.java | 44 - .../org/sonar/plugins/pmd/PmdVersion.java | 51 - .../pmd/PmdViolationToRuleViolation.java | 77 - .../sonar/plugins/pmd/SonarWayProfile.java | 53 - .../pmd/SonarWayWithFindbugsProfile.java | 43 - .../plugins/pmd/SunConventionsProfile.java | 53 - .../org/sonar/plugins/pmd/package-info.java | 25 - .../sonar/plugins/pmd/xml/PmdProperty.java | 58 - .../org/sonar/plugins/pmd/xml/PmdRule.java | 124 -- .../org/sonar/plugins/pmd/xml/PmdRuleset.java | 58 - .../resources/org/sonar/l10n/pmd.properties | 287 ---- .../JUnitAssertionsShouldIncludeMessage.html | 8 - .../rules/pmd-unit-tests/JUnitSpelling.html | 9 - .../pmd-unit-tests/JUnitStaticSuite.html | 9 - .../JUnitTestsShouldIncludeAssert.html | 10 - .../SimplifyBooleanAssertion.html | 9 - .../TestClassWithoutTestCases.html | 10 - .../UnnecessaryBooleanAssertion.html | 7 - .../UseAssertEqualsInsteadOfAssertTrue.html | 10 - .../UseAssertNullInsteadOfAssertTrue.html | 13 - .../UseAssertSameInsteadOfAssertTrue.html | 11 - .../AbstractClassWithoutAbstractMethod.html | 1 - .../pmd/AbstractClassWithoutAnyMethod.html | 7 - .../l10n/pmd/rules/pmd/AbstractNaming.html | 5 - .../rules/pmd/AccessorClassGeneration.html | 1 - .../l10n/pmd/rules/pmd/AddEmptyString.html | 1 - .../rules/pmd/AppendCharacterWithChar.html | 1 - .../pmd/rules/pmd/ArrayIsStoredDirectly.html | 1 - .../pmd/rules/pmd/AssignmentInOperand.html | 1 - .../rules/pmd/AssignmentToNonFinalStatic.html | 1 - .../pmd/rules/pmd/AtLeastOneConstructor.html | 1 - .../pmd/AvoidAccessibilityAlteration.html | 1 - .../l10n/pmd/rules/pmd/AvoidArrayLoops.html | 1 - .../rules/pmd/AvoidAssertAsIdentifier.html | 1 - .../pmd/rules/pmd/AvoidCallingFinalize.html | 1 - .../pmd/AvoidCatchingGenericException.html | 1 - .../l10n/pmd/rules/pmd/AvoidCatchingNPE.html | 1 - .../pmd/rules/pmd/AvoidCatchingThrowable.html | 1 - .../rules/pmd/AvoidConstantsInterface.html | 1 - ...ecimalLiteralsInBigDecimalConstructor.html | 1 - .../rules/pmd/AvoidDeeplyNestedIfStmts.html | 1 - .../l10n/pmd/rules/pmd/AvoidDollarSigns.html | 1 - .../pmd/rules/pmd/AvoidDuplicateLiterals.html | 12 - .../pmd/rules/pmd/AvoidEnumAsIdentifier.html | 1 - .../pmd/AvoidFieldNameMatchingMethodName.html | 9 - .../pmd/AvoidFieldNameMatchingTypeName.html | 7 - .../rules/pmd/AvoidFinalLocalVariable.html | 8 - .../AvoidInstanceofChecksInCatchClause.html | 1 - .../pmd/AvoidInstantiatingObjectsInLoops.html | 1 - .../rules/pmd/AvoidLiteralsInIfCondition.html | 1 - .../pmd/AvoidLosingExceptionInformation.html | 1 - .../pmd/AvoidMultipleUnaryOperators.html | 20 - .../pmd/rules/pmd/AvoidPrintStackTrace.html | 1 - .../pmd/AvoidProtectedFieldInFinalClass.html | 1 - .../rules/pmd/AvoidReassigningParameters.html | 1 - .../rules/pmd/AvoidRethrowingException.html | 1 - .../pmd/rules/pmd/AvoidStringBufferField.html | 6 - .../pmd/AvoidSynchronizedAtMethodLevel.html | 1 - .../l10n/pmd/rules/pmd/AvoidThreadGroup.html | 1 - ...oidThrowingNewInstanceOfSameException.html | 13 - .../AvoidThrowingNullPointerException.html | 1 - .../pmd/AvoidThrowingRawExceptionTypes.html | 1 - .../pmd/rules/pmd/AvoidUsingHardCodedIP.html | 1 - .../pmd/rules/pmd/AvoidUsingNativeCode.html | 1 - .../pmd/rules/pmd/AvoidUsingOctalValues.html | 1 - .../pmd/rules/pmd/AvoidUsingShortType.html | 1 - .../pmd/rules/pmd/AvoidUsingVolatile.html | 1 - .../l10n/pmd/rules/pmd/BadComparison.html | 1 - .../rules/pmd/BeanMembersShouldSerialize.html | 1 - .../rules/pmd/BigIntegerInstantiation.html | 1 - .../pmd/rules/pmd/BooleanGetMethodName.html | 1 - .../pmd/rules/pmd/BooleanInstantiation.html | 1 - .../l10n/pmd/rules/pmd/BooleanInversion.html | 1 - .../l10n/pmd/rules/pmd/BrokenNullCheck.html | 1 - .../l10n/pmd/rules/pmd/ByteInstantiation.html | 7 - .../l10n/pmd/rules/pmd/CallSuperFirst.html | 9 - .../pmd/rules/pmd/CallSuperInConstructor.html | 1 - .../l10n/pmd/rules/pmd/CallSuperLast.html | 9 - .../l10n/pmd/rules/pmd/CheckResultSet.html | 1 - .../pmd/ClassCastExceptionWithToArray.html | 1 - .../pmd/rules/pmd/ClassNamingConventions.html | 1 - ...hOnlyPrivateConstructorsShouldBeFinal.html | 6 - .../CloneMethodMustImplementCloneable.html | 1 - ...CloneThrowsCloneNotSupportedException.html | 1 - .../l10n/pmd/rules/pmd/CloseResource.html | 9 - .../rules/pmd/CollapsibleIfStatements.html | 1 - .../rules/pmd/CompareObjectsWithEquals.html | 1 - .../l10n/pmd/rules/pmd/ConfusingTernary.html | 1 - .../rules/pmd/ConsecutiveLiteralAppends.html | 1 - .../ConstructorCallsOverridableMethod.html | 27 - .../pmd/rules/pmd/CouplingBetweenObjects.html | 1 - .../pmd/rules/pmd/CyclomaticComplexity.html | 1 - .../rules/pmd/DataflowAnomalyAnalysis.html | 1 - .../pmd/DefaultLabelNotLastInSwitchStmt.html | 15 - .../l10n/pmd/rules/pmd/DefaultPackage.html | 1 - .../DoNotCallGarbageCollectionExplicitly.html | 20 - .../pmd/rules/pmd/DoNotCallSystemExit.html | 1 - .../rules/pmd/DoNotExtendJavaLangError.html | 1 - .../pmd/rules/pmd/DoNotHardCodeSDCard.html | 1 - .../pmd/DoNotThrowExceptionInFinally.html | 20 - .../l10n/pmd/rules/pmd/DoNotUseThreads.html | 1 - .../l10n/pmd/rules/pmd/DontCallThreadRun.html | 1 - .../pmd/rules/pmd/DontImportJavaLang.html | 1 - .../l10n/pmd/rules/pmd/DontImportSun.html | 1 - .../rules/pmd/DontNestJsfInJstlIteration.html | 1 - .../pmd/rules/pmd/DoubleCheckedLocking.html | 16 - .../l10n/pmd/rules/pmd/DuplicateImports.html | 1 - .../l10n/pmd/rules/pmd/EmptyCatchBlock.html | 1 - .../l10n/pmd/rules/pmd/EmptyFinalizer.html | 1 - .../l10n/pmd/rules/pmd/EmptyFinallyBlock.html | 1 - .../sonar/l10n/pmd/rules/pmd/EmptyIfStmt.html | 1 - .../l10n/pmd/rules/pmd/EmptyInitializer.html | 10 - ...MethodInAbstractClassShouldBeAbstract.html | 15 - .../rules/pmd/EmptyStatementNotInLoop.html | 1 - .../pmd/rules/pmd/EmptyStaticInitializer.html | 1 - .../pmd/rules/pmd/EmptySwitchStatements.html | 1 - .../pmd/rules/pmd/EmptySynchronizedBlock.html | 1 - .../l10n/pmd/rules/pmd/EmptyTryBlock.html | 1 - .../l10n/pmd/rules/pmd/EmptyWhileStmt.html | 1 - .../sonar/l10n/pmd/rules/pmd/EqualsNull.html | 1 - .../pmd/rules/pmd/ExceptionAsFlowControl.html | 1 - .../pmd/rules/pmd/ExcessiveClassLength.html | 1 - .../l10n/pmd/rules/pmd/ExcessiveImports.html | 1 - .../pmd/rules/pmd/ExcessiveMethodLength.html | 1 - .../pmd/rules/pmd/ExcessiveParameterList.html | 1 - .../pmd/rules/pmd/ExcessivePublicCount.html | 1 - .../rules/pmd/FinalFieldCouldBeStatic.html | 1 - .../pmd/FinalizeDoesNotCallSuperFinalize.html | 1 - .../pmd/FinalizeOnlyCallsSuperFinalize.html | 1 - .../pmd/rules/pmd/FinalizeOverloaded.html | 1 - .../rules/pmd/FinalizeShouldBeProtected.html | 1 - .../rules/pmd/ForLoopShouldBeWhileLoop.html | 1 - .../pmd/rules/pmd/ForLoopsMustUseBraces.html | 1 - .../l10n/pmd/rules/pmd/GenericsNaming.html | 1 - .../l10n/pmd/rules/pmd/GuardDebugLogging.html | 1 - .../pmd/rules/pmd/IdempotentOperations.html | 1 - .../rules/pmd/IfElseStmtsMustUseBraces.html | 1 - .../pmd/rules/pmd/IfStmtsMustUseBraces.html | 1 - .../l10n/pmd/rules/pmd/ImmutableField.html | 1 - .../pmd/rules/pmd/ImportFromSamePackage.html | 1 - .../pmd/InefficientEmptyStringCheck.html | 1 - .../rules/pmd/InefficientStringBuffering.html | 1 - .../rules/pmd/InstantiationToGetClass.html | 1 - .../InsufficientStringBufferDeclaration.html | 1 - .../pmd/rules/pmd/IntegerInstantiation.html | 1 - .../pmd/rules/pmd/JumbledIncrementer.html | 12 - .../rules/pmd/LocalHomeNamingConvention.html | 1 - ...LocalInterfaceSessionNamingConvention.html | 1 - .../rules/pmd/LocalVariableCouldBeFinal.html | 9 - .../pmd/rules/pmd/LoggerIsNotStaticFinal.html | 1 - .../l10n/pmd/rules/pmd/LongInstantiation.html | 7 - .../l10n/pmd/rules/pmd/LongVariable.html | 1 - .../l10n/pmd/rules/pmd/LooseCoupling.html | 1 - .../MDBAndSessionBeanNamingConvention.html | 1 - .../rules/pmd/MethodArgumentCouldBeFinal.html | 1 - .../rules/pmd/MethodNamingConventions.html | 7 - .../rules/pmd/MethodReturnsInternalArray.html | 1 - .../MethodWithSameNameAsEnclosingClass.html | 9 - .../pmd/rules/pmd/MisleadingVariableName.html | 9 - .../pmd/rules/pmd/MisplacedNullCheck.html | 8 - .../pmd/rules/pmd/MissingBreakInSwitch.html | 1 - .../rules/pmd/MissingSerialVersionUID.html | 1 - ...gStaticMethodInNonInstantiatableClass.html | 1 - .../l10n/pmd/rules/pmd/MoreThanOneLogger.html | 1 - .../l10n/pmd/rules/pmd/NPathComplexity.html | 8 - .../pmd/rules/pmd/NcssConstructorCount.html | 1 - .../l10n/pmd/rules/pmd/NcssMethodCount.html | 1 - .../l10n/pmd/rules/pmd/NcssTypeCount.html | 1 - .../sonar/l10n/pmd/rules/pmd/NoPackage.html | 6 - .../pmd/NonCaseLabelInSwitchStatement.html | 1 - .../pmd/rules/pmd/NonStaticInitializer.html | 1 - .../pmd/rules/pmd/NonThreadSafeSingleton.html | 1 - .../l10n/pmd/rules/pmd/NullAssignment.html | 1 - .../l10n/pmd/rules/pmd/OnlyOneReturn.html | 1 - .../pmd/rules/pmd/OptimizableToArrayCall.html | 1 - .../pmd/OverrideBothEqualsAndHashcode.html | 26 - .../sonar/l10n/pmd/rules/pmd/PackageCase.html | 6 - .../PositionLiteralsFirstInComparisons.html | 1 - .../pmd/rules/pmd/PreserveStackTrace.html | 1 - .../rules/pmd/ProperCloneImplementation.html | 8 - .../l10n/pmd/rules/pmd/ProperLogger.html | 1 - .../sonar/l10n/pmd/rules/pmd/ProtectLogD.html | 12 - .../sonar/l10n/pmd/rules/pmd/ProtectLogV.html | 10 - .../pmd/RemoteInterfaceNamingConvention.html | 1 - ...emoteSessionInterfaceNamingConvention.html | 1 - .../pmd/ReplaceEnumerationWithIterator.html | 1 - .../rules/pmd/ReplaceHashtableWithMap.html | 1 - .../pmd/rules/pmd/ReplaceVectorWithList.html | 1 - .../pmd/ReturnEmptyArrayRatherThanNull.html | 19 - .../pmd/rules/pmd/ReturnFromFinallyBlock.html | 1 - .../pmd/rules/pmd/ShortInstantiation.html | 7 - .../l10n/pmd/rules/pmd/ShortMethodName.html | 7 - .../l10n/pmd/rules/pmd/ShortVariable.html | 1 - .../pmd/SignatureDeclareThrowsException.html | 1 - .../pmd/SimpleDateFormatNeedsLocale.html | 1 - .../rules/pmd/SimplifyBooleanExpressions.html | 10 - .../pmd/rules/pmd/SimplifyBooleanReturns.html | 16 - .../pmd/rules/pmd/SimplifyConditional.html | 1 - .../pmd/rules/pmd/SimplifyStartsWith.html | 1 - .../l10n/pmd/rules/pmd/SingularField.html | 1 - .../pmd/StaticEJBFieldShouldBeFinal.html | 1 - .../StringBufferInstantiationWithChar.html | 1 - .../pmd/rules/pmd/StringInstantiation.html | 1 - .../l10n/pmd/rules/pmd/StringToString.html | 1 - .../pmd/SuspiciousConstantFieldName.html | 9 - .../rules/pmd/SuspiciousEqualsMethodName.html | 11 - .../pmd/SuspiciousHashcodeMethodName.html | 7 - .../pmd/rules/pmd/SuspiciousOctalEscape.html | 1 - .../l10n/pmd/rules/pmd/SwitchDensity.html | 1 - .../pmd/SwitchStmtsShouldHaveDefault.html | 11 - .../l10n/pmd/rules/pmd/SystemPrintln.html | 1 - .../TooFewBranchesForASwitchStatement.html | 16 - .../l10n/pmd/rules/pmd/TooManyFields.html | 1 - .../l10n/pmd/rules/pmd/TooManyMethods.html | 1 - .../pmd/rules/pmd/TooManyStaticImports.html | 1 - .../pmd/UncommentedEmptyConstructor.html | 1 - .../pmd/rules/pmd/UncommentedEmptyMethod.html | 1 - .../rules/pmd/UnconditionalIfStatement.html | 1 - .../pmd/rules/pmd/UnnecessaryCaseChange.html | 1 - .../pmd/rules/pmd/UnnecessaryConstructor.html | 1 - .../pmd/UnnecessaryConversionTemporary.html | 1 - .../rules/pmd/UnnecessaryFinalModifier.html | 1 - .../pmd/UnnecessaryLocalBeforeReturn.html | 1 - .../pmd/rules/pmd/UnnecessaryParentheses.html | 8 - .../l10n/pmd/rules/pmd/UnnecessaryReturn.html | 1 - .../pmd/UnnecessaryWrapperObjectCreation.html | 1 - .../UnsynchronizedStaticDateFormatter.html | 1 - .../pmd/rules/pmd/UnusedFormalParameter.html | 1 - .../l10n/pmd/rules/pmd/UnusedImports.html | 6 - .../pmd/rules/pmd/UnusedLocalVariable.html | 1 - .../l10n/pmd/rules/pmd/UnusedModifier.html | 1 - .../rules/pmd/UnusedNullCheckInEquals.html | 1 - .../pmd/rules/pmd/UnusedPrivateField.html | 1 - .../pmd/rules/pmd/UnusedPrivateMethod.html | 1 - .../pmd/UseArrayListInsteadOfVector.html | 1 - .../l10n/pmd/rules/pmd/UseArraysAsList.html | 1 - .../pmd/rules/pmd/UseCollectionIsEmpty.html | 1 - .../pmd/rules/pmd/UseConcurrentHashMap.html | 1 - .../rules/pmd/UseCorrectExceptionLogging.html | 1 - .../rules/pmd/UseEqualsToCompareStrings.html | 1 - .../l10n/pmd/rules/pmd/UseIndexOfChar.html | 1 - .../pmd/UseLocaleWithCaseConversions.html | 1 - .../pmd/UseNotifyAllInsteadOfNotify.html | 1 - .../pmd/rules/pmd/UseProperClassLoader.html | 1 - .../l10n/pmd/rules/pmd/UseSingleton.html | 1 - .../pmd/UseStringBufferForStringAppends.html | 1 - .../pmd/rules/pmd/UseStringBufferLength.html | 1 - .../pmd/UselessOperationOnImmutable.html | 1 - .../rules/pmd/UselessOverridingMethod.html | 1 - .../pmd/rules/pmd/UselessStringValueOf.html | 1 - .../rules/pmd/VariableNamingConventions.html | 1 - .../rules/pmd/WhileLoopsMustUseBraces.html | 1 - .../sonar/l10n/pmd/rules/pmd/XPathRule.html | 20 - .../sonar/plugins/pmd/pmd-plugin.properties | 1 - .../sonar/plugins/pmd/profile-sonar-way.xml | 97 -- .../plugins/pmd/profile-sun-conventions.xml | 6 - .../sonar/plugins/pmd/rules-unit-tests.xml | 42 - .../resources/org/sonar/plugins/pmd/rules.xml | 1254 ----------------- .../plugins/pmd/PmdConfigurationTest.java | 108 -- .../sonar/plugins/pmd/PmdExecutorTest.java | 128 -- .../sonar/plugins/pmd/PmdLevelUtilsTest.java | 47 - .../org/sonar/plugins/pmd/PmdPluginTest.java | 38 - .../plugins/pmd/PmdProfileExporterTest.java | 143 -- .../plugins/pmd/PmdProfileImporterTest.java | 176 --- .../sonar/plugins/pmd/PmdProfilesTest.java | 80 -- .../plugins/pmd/PmdRuleRepositoryTest.java | 100 -- .../org/sonar/plugins/pmd/PmdSensorTest.java | 162 --- .../sonar/plugins/pmd/PmdTemplateTest.java | 105 -- .../pmd/PmdUnitTestsRuleRepositoryTest.java | 71 - .../org/sonar/plugins/pmd/PmdVersionTest.java | 31 - .../pmd/PmdViolationToRuleViolationTest.java | 88 -- .../pmd/complex-with-unknown-nodes.xml | 28 - .../org/sonar/plugins/pmd/export_simple.xml | 16 - .../sonar/plugins/pmd/export_xpath_rules.xml | 12 - .../resources/org/sonar/plugins/pmd/junit.xml | 7 - .../org/sonar/plugins/pmd/rules-extension.xml | 6 - .../org/sonar/plugins/pmd/simple.xml | 18 - pom.xml | 6 +- sonar-application/pom.xml | 3 +- sonar-server/pom.xml | 4 +- 293 files changed, 8 insertions(+), 5467 deletions(-) delete mode 100644 plugins/sonar-pmd-plugin/infinitest.args delete mode 100644 plugins/sonar-pmd-plugin/infinitest.filters delete mode 100644 plugins/sonar-pmd-plugin/pom.xml delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdConfiguration.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdConstants.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdExecutor.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdLevelUtils.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdPlugin.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdProfileExporter.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdProfileImporter.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdRuleRepository.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdSensor.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdTemplate.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdUnitTestsRuleRepository.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdVersion.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdViolationToRuleViolation.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/SonarWayProfile.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/SonarWayWithFindbugsProfile.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/SunConventionsProfile.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/package-info.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdProperty.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdRule.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdRuleset.java delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd.properties delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitAssertionsShouldIncludeMessage.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitSpelling.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitStaticSuite.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitTestsShouldIncludeAssert.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/SimplifyBooleanAssertion.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/TestClassWithoutTestCases.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UnnecessaryBooleanAssertion.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UseAssertEqualsInsteadOfAssertTrue.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UseAssertNullInsteadOfAssertTrue.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UseAssertSameInsteadOfAssertTrue.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AbstractClassWithoutAbstractMethod.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AbstractClassWithoutAnyMethod.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AbstractNaming.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AccessorClassGeneration.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AddEmptyString.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AppendCharacterWithChar.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ArrayIsStoredDirectly.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AssignmentInOperand.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AssignmentToNonFinalStatic.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AtLeastOneConstructor.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidAccessibilityAlteration.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidArrayLoops.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidAssertAsIdentifier.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCallingFinalize.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCatchingGenericException.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCatchingNPE.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCatchingThrowable.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidConstantsInterface.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDecimalLiteralsInBigDecimalConstructor.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDeeplyNestedIfStmts.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDollarSigns.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDuplicateLiterals.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidEnumAsIdentifier.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidFieldNameMatchingMethodName.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidFieldNameMatchingTypeName.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidFinalLocalVariable.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidInstanceofChecksInCatchClause.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidInstantiatingObjectsInLoops.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidLiteralsInIfCondition.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidLosingExceptionInformation.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidMultipleUnaryOperators.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidPrintStackTrace.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidProtectedFieldInFinalClass.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidReassigningParameters.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidRethrowingException.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidStringBufferField.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidSynchronizedAtMethodLevel.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThreadGroup.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThrowingNewInstanceOfSameException.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThrowingNullPointerException.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThrowingRawExceptionTypes.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingHardCodedIP.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingNativeCode.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingOctalValues.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingShortType.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingVolatile.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BadComparison.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BeanMembersShouldSerialize.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BigIntegerInstantiation.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BooleanGetMethodName.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BooleanInstantiation.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BooleanInversion.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BrokenNullCheck.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ByteInstantiation.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CallSuperFirst.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CallSuperInConstructor.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CallSuperLast.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CheckResultSet.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ClassCastExceptionWithToArray.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ClassNamingConventions.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ClassWithOnlyPrivateConstructorsShouldBeFinal.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CloneMethodMustImplementCloneable.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CloneThrowsCloneNotSupportedException.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CloseResource.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CollapsibleIfStatements.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CompareObjectsWithEquals.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ConfusingTernary.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ConsecutiveLiteralAppends.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ConstructorCallsOverridableMethod.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CouplingBetweenObjects.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CyclomaticComplexity.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DataflowAnomalyAnalysis.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DefaultLabelNotLastInSwitchStmt.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DefaultPackage.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotCallGarbageCollectionExplicitly.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotCallSystemExit.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotExtendJavaLangError.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotHardCodeSDCard.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotThrowExceptionInFinally.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotUseThreads.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontCallThreadRun.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontImportJavaLang.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontImportSun.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontNestJsfInJstlIteration.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoubleCheckedLocking.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DuplicateImports.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyCatchBlock.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyFinalizer.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyFinallyBlock.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyIfStmt.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyInitializer.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyMethodInAbstractClassShouldBeAbstract.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyStatementNotInLoop.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyStaticInitializer.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptySwitchStatements.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptySynchronizedBlock.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyTryBlock.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyWhileStmt.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EqualsNull.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExceptionAsFlowControl.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveClassLength.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveImports.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveMethodLength.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveParameterList.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessivePublicCount.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalFieldCouldBeStatic.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeDoesNotCallSuperFinalize.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeOnlyCallsSuperFinalize.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeOverloaded.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeShouldBeProtected.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ForLoopShouldBeWhileLoop.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ForLoopsMustUseBraces.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/GenericsNaming.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/GuardDebugLogging.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IdempotentOperations.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IfElseStmtsMustUseBraces.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IfStmtsMustUseBraces.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ImmutableField.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ImportFromSamePackage.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InefficientEmptyStringCheck.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InefficientStringBuffering.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InstantiationToGetClass.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InsufficientStringBufferDeclaration.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IntegerInstantiation.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/JumbledIncrementer.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LocalHomeNamingConvention.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LocalInterfaceSessionNamingConvention.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LocalVariableCouldBeFinal.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LoggerIsNotStaticFinal.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LongInstantiation.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LongVariable.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LooseCoupling.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MDBAndSessionBeanNamingConvention.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodArgumentCouldBeFinal.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodNamingConventions.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodReturnsInternalArray.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodWithSameNameAsEnclosingClass.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MisleadingVariableName.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MisplacedNullCheck.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MissingBreakInSwitch.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MissingSerialVersionUID.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MissingStaticMethodInNonInstantiatableClass.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MoreThanOneLogger.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NPathComplexity.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NcssConstructorCount.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NcssMethodCount.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NcssTypeCount.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NoPackage.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NonCaseLabelInSwitchStatement.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NonStaticInitializer.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NonThreadSafeSingleton.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NullAssignment.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/OnlyOneReturn.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/OptimizableToArrayCall.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/OverrideBothEqualsAndHashcode.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/PackageCase.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/PositionLiteralsFirstInComparisons.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/PreserveStackTrace.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProperCloneImplementation.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProperLogger.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProtectLogD.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProtectLogV.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/RemoteInterfaceNamingConvention.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/RemoteSessionInterfaceNamingConvention.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReplaceEnumerationWithIterator.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReplaceHashtableWithMap.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReplaceVectorWithList.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReturnEmptyArrayRatherThanNull.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReturnFromFinallyBlock.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ShortInstantiation.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ShortMethodName.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ShortVariable.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SignatureDeclareThrowsException.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimpleDateFormatNeedsLocale.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyBooleanExpressions.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyBooleanReturns.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyConditional.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyStartsWith.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SingularField.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StaticEJBFieldShouldBeFinal.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StringBufferInstantiationWithChar.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StringInstantiation.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StringToString.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousConstantFieldName.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousEqualsMethodName.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousHashcodeMethodName.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousOctalEscape.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SwitchDensity.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SwitchStmtsShouldHaveDefault.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SystemPrintln.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooFewBranchesForASwitchStatement.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooManyFields.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooManyMethods.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooManyStaticImports.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UncommentedEmptyConstructor.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UncommentedEmptyMethod.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnconditionalIfStatement.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryCaseChange.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryConstructor.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryConversionTemporary.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryFinalModifier.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryLocalBeforeReturn.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryParentheses.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryReturn.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryWrapperObjectCreation.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnsynchronizedStaticDateFormatter.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedFormalParameter.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedImports.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedLocalVariable.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedModifier.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedNullCheckInEquals.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedPrivateField.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedPrivateMethod.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseArrayListInsteadOfVector.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseArraysAsList.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseCollectionIsEmpty.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseConcurrentHashMap.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseCorrectExceptionLogging.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseEqualsToCompareStrings.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseIndexOfChar.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseLocaleWithCaseConversions.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseNotifyAllInsteadOfNotify.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseProperClassLoader.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseSingleton.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseStringBufferForStringAppends.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseStringBufferLength.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UselessOperationOnImmutable.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UselessOverridingMethod.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UselessStringValueOf.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/VariableNamingConventions.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/WhileLoopsMustUseBraces.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/XPathRule.html delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/pmd-plugin.properties delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/profile-sonar-way.xml delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/profile-sun-conventions.xml delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/rules-unit-tests.xml delete mode 100644 plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/rules.xml delete mode 100644 plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdConfigurationTest.java delete mode 100644 plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdExecutorTest.java delete mode 100644 plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdLevelUtilsTest.java delete mode 100644 plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdPluginTest.java delete mode 100644 plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileExporterTest.java delete mode 100644 plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileImporterTest.java delete mode 100644 plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfilesTest.java delete mode 100644 plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdRuleRepositoryTest.java delete mode 100644 plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdSensorTest.java delete mode 100644 plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdTemplateTest.java delete mode 100644 plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdUnitTestsRuleRepositoryTest.java delete mode 100644 plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdVersionTest.java delete mode 100644 plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdViolationToRuleViolationTest.java delete mode 100644 plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/complex-with-unknown-nodes.xml delete mode 100644 plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/export_simple.xml delete mode 100644 plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/export_xpath_rules.xml delete mode 100644 plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/junit.xml delete mode 100644 plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/rules-extension.xml delete mode 100644 plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/simple.xml diff --git a/plugins/sonar-pmd-plugin/infinitest.args b/plugins/sonar-pmd-plugin/infinitest.args deleted file mode 100644 index ed9f41dadc7..00000000000 --- a/plugins/sonar-pmd-plugin/infinitest.args +++ /dev/null @@ -1 +0,0 @@ --Djava.awt.headless=true \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/infinitest.filters b/plugins/sonar-pmd-plugin/infinitest.filters deleted file mode 100644 index d0aa9ab8cc6..00000000000 --- a/plugins/sonar-pmd-plugin/infinitest.filters +++ /dev/null @@ -1,3 +0,0 @@ -# These tests fail in Eclipse. Until they are fixed, let's ignore them - -.*PmdExecutorTest diff --git a/plugins/sonar-pmd-plugin/pom.xml b/plugins/sonar-pmd-plugin/pom.xml deleted file mode 100644 index 17877f49e36..00000000000 --- a/plugins/sonar-pmd-plugin/pom.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - 4.0.0 - - org.codehaus.sonar - sonar - 3.4-SNAPSHOT - ../.. - - org.codehaus.sonar.plugins - sonar-pmd-plugin - sonar-plugin - Sonar :: Plugins :: PMD - PMD is a tool that looks for potential problems like possible bugs, dead code, suboptimal code, overcomplicated expressions or duplicate code. - - - 4.3 - - - - - org.codehaus.sonar - sonar-java-api - provided - - - org.codehaus.sonar - sonar-plugin-api - provided - - - pmd - pmd - ${pmd.version} - - - junit - junit - - - - ant - ant - - - xom - xom - - - - - - - org.apache.maven - maven-project - test - - - - org.codehaus.sonar - sonar-testing-harness - test - - - - org.codehaus.sonar.plugins - sonar-l10n-en-plugin - ${project.version} - test - - - - - - - src/main/resources - true - - - - - - ${basedir}/src/main/resources - - - ${basedir}/src/test/resources - - - - - - org.codehaus.sonar - sonar-packaging-maven-plugin - - pmd - PMD - PMD ${pmd.version}.]]> - org.sonar.plugins.pmd.PmdPlugin - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - enforce-plugin-size - - enforce - - verify - - - - 1600000 - 1400000 - - ${project.build.directory}/${project.build.finalName}.jar - - - - - - - - - - diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdConfiguration.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdConfiguration.java deleted file mode 100644 index c2331b8b769..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdConfiguration.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import net.sourceforge.pmd.Report; -import net.sourceforge.pmd.renderers.Renderer; -import net.sourceforge.pmd.renderers.XMLRenderer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.sonar.api.BatchExtension; -import org.sonar.api.Property; -import org.sonar.api.config.Settings; -import org.sonar.api.resources.ProjectFileSystem; -import org.sonar.api.utils.SonarException; - -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; - -@org.sonar.api.Properties({ - @Property( - key = PmdConfiguration.PROPERTY_GENERATE_XML, - defaultValue = "false", - name = "Generate XML Report", - project = false, - global = false - ) -}) -public class PmdConfiguration implements BatchExtension { - private static final Logger LOG = LoggerFactory.getLogger(PmdConfiguration.class); - - public static final String PROPERTY_GENERATE_XML = "sonar.pmd.generateXml"; - public static final String PMD_RESULT_XML = "pmd-result.xml"; - - private final ProjectFileSystem projectFileSystem; - private final Settings settings; - - public PmdConfiguration(ProjectFileSystem projectFileSystem, Settings settings) { - this.projectFileSystem = projectFileSystem; - this.settings = settings; - } - - public File getTargetXMLReport() { - if (settings.getBoolean(PROPERTY_GENERATE_XML)) { - return projectFileSystem.resolvePath(PMD_RESULT_XML); - } - return null; - } - - public File dumpXmlRuleSet(String repositoryKey, String rulesXml) { - try { - File configurationFile = projectFileSystem.writeToWorkingDirectory(rulesXml, repositoryKey + ".xml"); - - LOG.info("PMD configuration: " + configurationFile.getAbsolutePath()); - - return configurationFile; - } catch (IOException e) { - throw new SonarException("Fail to save the PMD configuration", e); - } - } - - public File dumpXmlReport(Report report) { - if (!settings.getBoolean(PROPERTY_GENERATE_XML)) { - return null; - } - - try { - String reportAsString = reportToString(report); - - File reportFile = projectFileSystem.writeToWorkingDirectory(reportAsString, PMD_RESULT_XML); - - LOG.info("PMD output report: " + reportFile.getAbsolutePath()); - - return reportFile; - } catch (IOException e) { - throw new SonarException("Fail to save the PMD report", e); - } - } - - private static String reportToString(Report report) throws IOException { - StringWriter output = new StringWriter(); - - Renderer xmlRenderer = new XMLRenderer(); - xmlRenderer.setWriter(output); - xmlRenderer.start(); - xmlRenderer.renderFileReport(report); - xmlRenderer.end(); - - return output.toString(); - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdConstants.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdConstants.java deleted file mode 100644 index 613903da2e8..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdConstants.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import org.sonar.api.CoreProperties; - -public final class PmdConstants { - public static final String REPOSITORY_KEY = CoreProperties.PMD_PLUGIN; - public static final String REPOSITORY_NAME = "PMD"; - public static final String TEST_REPOSITORY_KEY = "pmd-unit-tests"; - public static final String TEST_REPOSITORY_NAME = "PMD Unit Tests"; - public static final String PLUGIN_NAME = "PMD"; - public static final String PLUGIN_KEY = CoreProperties.PMD_PLUGIN; - public static final String XPATH_CLASS = "net.sourceforge.pmd.rules.XPathRule"; - public static final String XPATH_EXPRESSION_PARAM = "xpath"; - public static final String XPATH_MESSAGE_PARAM = "message"; - - private PmdConstants() { - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdExecutor.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdExecutor.java deleted file mode 100644 index 7dd02a5fac7..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdExecutor.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.io.Closeables; -import net.sourceforge.pmd.Report; -import net.sourceforge.pmd.RuleContext; -import net.sourceforge.pmd.RuleSet; -import net.sourceforge.pmd.RuleSetFactory; -import net.sourceforge.pmd.RuleSets; -import org.sonar.api.BatchExtension; -import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.InputFile; -import org.sonar.api.resources.Java; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.ProjectFileSystem; -import org.sonar.api.utils.TimeProfiler; -import org.sonar.java.api.JavaUtils; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.nio.charset.Charset; -import java.util.List; - -public class PmdExecutor implements BatchExtension { - private final Project project; - private final ProjectFileSystem projectFileSystem; - private final RulesProfile rulesProfile; - private final PmdProfileExporter pmdProfileExporter; - private final PmdConfiguration pmdConfiguration; - - public PmdExecutor(Project project, ProjectFileSystem projectFileSystem, RulesProfile rulesProfile, PmdProfileExporter pmdProfileExporter, PmdConfiguration pmdConfiguration) { - this.project = project; - this.projectFileSystem = projectFileSystem; - this.rulesProfile = rulesProfile; - this.pmdProfileExporter = pmdProfileExporter; - this.pmdConfiguration = pmdConfiguration; - } - - public Report execute() { - TimeProfiler profiler = new TimeProfiler().start("Execute PMD " + PmdVersion.getVersion()); - - ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); - try { - Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); - - return executePmd(); - } finally { - Thread.currentThread().setContextClassLoader(initialClassLoader); - profiler.stop(); - } - } - - private Report executePmd() { - Report report = new Report(); - - RuleContext context = new RuleContext(); - context.setReport(report); - - PmdTemplate pmdFactory = createPmdTemplate(); - executeRules(pmdFactory, context, projectFileSystem.mainFiles(Java.KEY), PmdConstants.REPOSITORY_KEY); - executeRules(pmdFactory, context, projectFileSystem.testFiles(Java.KEY), PmdConstants.TEST_REPOSITORY_KEY); - - pmdConfiguration.dumpXmlReport(report); - - return report; - } - - public void executeRules(PmdTemplate pmdFactory, RuleContext ruleContext, List files, String repositoryKey) { - if (files.isEmpty()) { - return; // Nothing to analyse - } - - RuleSets rulesets = createRulesets(repositoryKey); - if (rulesets.getAllRules().isEmpty()) { - return; // No rule - } - - Charset encoding = projectFileSystem.getSourceCharset(); - - for (InputFile file : files) { - pmdFactory.process(file, encoding, rulesets, ruleContext); - } - } - - private RuleSets createRulesets(String repositoryKey) { - String rulesXml = pmdProfileExporter.exportProfile(repositoryKey, rulesProfile); - - pmdConfiguration.dumpXmlRuleSet(repositoryKey, rulesXml); - - return new RuleSets(readRuleSet(rulesXml)); - } - - private static RuleSet readRuleSet(String rulesXml) { - InputStream rulesInput = null; - try { - rulesInput = new ByteArrayInputStream(rulesXml.getBytes()); - - return new RuleSetFactory().createRuleSet(rulesInput); - } finally { - Closeables.closeQuietly(rulesInput); - } - } - - @VisibleForTesting - PmdTemplate createPmdTemplate() { - return new PmdTemplate(JavaUtils.getSourceVersion(project)); - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdLevelUtils.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdLevelUtils.java deleted file mode 100644 index dc56a9ca29b..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdLevelUtils.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import com.google.common.collect.BiMap; -import com.google.common.collect.EnumHashBiMap; -import org.sonar.api.rules.RulePriority; - -import static com.google.common.collect.ImmutableMap.of; - -public final class PmdLevelUtils { - private static final BiMap LEVELS_PER_PRIORITY = EnumHashBiMap.create(of( - RulePriority.BLOCKER, "1", - RulePriority.CRITICAL, "2", - RulePriority.MAJOR, "3", - RulePriority.MINOR, "4", - RulePriority.INFO, "5")); - - private PmdLevelUtils() { - // only static methods - } - - public static RulePriority fromLevel(String level) { - return LEVELS_PER_PRIORITY.inverse().get(level); - } - - public static String toLevel(RulePriority priority) { - return LEVELS_PER_PRIORITY.get(priority); - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdPlugin.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdPlugin.java deleted file mode 100644 index 48d01e66053..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdPlugin.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import com.google.common.collect.ImmutableList; -import org.sonar.api.Extension; -import org.sonar.api.SonarPlugin; - -import java.util.List; - -public class PmdPlugin extends SonarPlugin { - public List> getExtensions() { - return ImmutableList.of( - PmdSensor.class, - PmdConfiguration.class, - PmdExecutor.class, - PmdRuleRepository.class, - PmdUnitTestsRuleRepository.class, - PmdProfileExporter.class, - PmdProfileImporter.class, - SonarWayProfile.class, - SonarWayWithFindbugsProfile.class, - SunConventionsProfile.class, - PmdViolationToRuleViolation.class); - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdProfileExporter.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdProfileExporter.java deleted file mode 100644 index d295f6b9c07..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdProfileExporter.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import com.google.common.annotations.VisibleForTesting; -import org.jdom.CDATA; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.output.Format; -import org.jdom.output.XMLOutputter; -import org.sonar.api.profiles.ProfileExporter; -import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.Java; -import org.sonar.api.rules.ActiveRule; -import org.sonar.api.rules.ActiveRuleParam; -import org.sonar.api.utils.SonarException; -import org.sonar.plugins.pmd.xml.PmdProperty; -import org.sonar.plugins.pmd.xml.PmdRule; -import org.sonar.plugins.pmd.xml.PmdRuleset; - -import java.io.IOException; -import java.io.StringWriter; -import java.io.Writer; -import java.util.ArrayList; -import java.util.List; - -public class PmdProfileExporter extends ProfileExporter { - public PmdProfileExporter() { - super(PmdConstants.REPOSITORY_KEY, PmdConstants.PLUGIN_NAME); - setSupportedLanguages(Java.KEY); - setMimeType("application/xml"); - } - - @Override - public void exportProfile(RulesProfile profile, Writer writer) { - try { - String xmlModules = exportProfile(PmdConstants.REPOSITORY_KEY, profile); - writer.append(xmlModules); - } catch (IOException e) { - throw new SonarException("Fail to export the profile " + profile, e); - } - } - - public String exportProfile(String repositoryKey, RulesProfile profile) { - PmdRuleset tree = createPmdRuleset(repositoryKey, profile.getActiveRulesByRepository(repositoryKey), profile.getName()); - return exportPmdRulesetToXml(tree); - } - - private PmdRuleset createPmdRuleset(String repositoryKey, List activeRules, String profileName) { - PmdRuleset ruleset = new PmdRuleset(profileName); - for (ActiveRule activeRule : activeRules) { - if (activeRule.getRule().getRepositoryKey().equals(repositoryKey)) { - String configKey = activeRule.getRule().getConfigKey(); - PmdRule rule = new PmdRule(configKey, PmdLevelUtils.toLevel(activeRule.getSeverity())); - if ((activeRule.getActiveRuleParams() != null) && !activeRule.getActiveRuleParams().isEmpty()) { - List properties = new ArrayList(); - for (ActiveRuleParam activeRuleParam : activeRule.getActiveRuleParams()) { - properties.add(new PmdProperty(activeRuleParam.getRuleParam().getKey(), activeRuleParam.getValue())); - } - rule.setProperties(properties); - } - ruleset.addRule(rule); - processXPathRule(activeRule.getRuleKey(), rule); - } - } - return ruleset; - } - - @VisibleForTesting - void processXPathRule(String sonarRuleKey, PmdRule rule) { - if (PmdConstants.XPATH_CLASS.equals(rule.getRef())) { - rule.setRef(null); - PmdProperty xpathMessage = rule.getProperty(PmdConstants.XPATH_MESSAGE_PARAM); - if (xpathMessage == null) { - throw new SonarException("Property '" + PmdConstants.XPATH_MESSAGE_PARAM + "' should be set for PMD rule " + sonarRuleKey); - } - rule.setMessage(xpathMessage.getValue()); - rule.removeProperty(PmdConstants.XPATH_MESSAGE_PARAM); - PmdProperty xpathExp = rule.getProperty(PmdConstants.XPATH_EXPRESSION_PARAM); - if (xpathExp == null) { - throw new SonarException("Property '" + PmdConstants.XPATH_EXPRESSION_PARAM + "' should be set for PMD rule " + sonarRuleKey); - } - xpathExp.setCdataValue(xpathExp.getValue()); - rule.setClazz(PmdConstants.XPATH_CLASS); - rule.setName(sonarRuleKey); - } - } - - private String exportPmdRulesetToXml(PmdRuleset pmdRuleset) { - Element eltRuleset = new Element("ruleset"); - for (PmdRule pmdRule : pmdRuleset.getPmdRules()) { - Element eltRule = new Element("rule"); - addAttribute(eltRule, "ref", pmdRule.getRef()); - addAttribute(eltRule, "class", pmdRule.getClazz()); - addAttribute(eltRule, "message", pmdRule.getMessage()); - addAttribute(eltRule, "name", pmdRule.getName()); - addChild(eltRule, "priority", pmdRule.getPriority()); - if (pmdRule.hasProperties()) { - Element eltProperties = new Element("properties"); - eltRule.addContent(eltProperties); - for (PmdProperty prop : pmdRule.getProperties()) { - Element eltProperty = new Element("property"); - eltProperty.setAttribute("name", prop.getName()); - if (prop.isCdataValue()) { - Element eltValue = new Element("value"); - eltValue.addContent(new CDATA(prop.getCdataValue())); - eltProperty.addContent(eltValue); - } else { - eltProperty.setAttribute("value", prop.getValue()); - } - eltProperties.addContent(eltProperty); - } - } - eltRuleset.addContent(eltRule); - } - XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat()); - StringWriter xml = new StringWriter(); - try { - serializer.output(new Document(eltRuleset), xml); - } catch (IOException e) { - throw new SonarException("A exception occured while generating the PMD configuration file.", e); - } - return xml.toString(); - } - - private void addChild(Element elt, String name, String text) { - if (text != null) { - elt.addContent(new Element(name).setText(text)); - } - } - - private void addAttribute(Element elt, String name, String value) { - if (value != null) { - elt.setAttribute(name, value); - } - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdProfileImporter.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdProfileImporter.java deleted file mode 100644 index 7524b9d2465..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdProfileImporter.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.Namespace; -import org.jdom.input.SAXBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.sonar.api.profiles.ProfileImporter; -import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.Java; -import org.sonar.api.rules.ActiveRule; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleFinder; -import org.sonar.api.rules.RuleQuery; -import org.sonar.api.utils.ValidationMessages; -import org.sonar.plugins.pmd.xml.PmdProperty; -import org.sonar.plugins.pmd.xml.PmdRule; -import org.sonar.plugins.pmd.xml.PmdRuleset; - -import javax.annotation.Nullable; - -import java.io.Reader; -import java.util.List; - -public class PmdProfileImporter extends ProfileImporter { - - private final RuleFinder ruleFinder; - private static final Logger LOG = LoggerFactory.getLogger(PmdProfileImporter.class); - - public PmdProfileImporter(RuleFinder ruleFinder) { - super(PmdConstants.REPOSITORY_KEY, PmdConstants.PLUGIN_NAME); - setSupportedLanguages(Java.KEY); - this.ruleFinder = ruleFinder; - } - - @Override - public RulesProfile importProfile(Reader pmdConfigurationFile, ValidationMessages messages) { - PmdRuleset pmdRuleset = parsePmdRuleset(pmdConfigurationFile, messages); - return createRuleProfile(pmdRuleset, messages); - } - - protected RulesProfile createRuleProfile(PmdRuleset pmdRuleset, ValidationMessages messages) { - RulesProfile profile = RulesProfile.create(); - for (PmdRule pmdRule : pmdRuleset.getPmdRules()) { - if (PmdConstants.XPATH_CLASS.equals(pmdRule.getClazz())) { - messages.addWarningText("PMD XPath rule '" + pmdRule.getName() - + "' can't be imported automatically. The rule must be created manually through the Sonar web interface."); - continue; - } - if (pmdRule.getRef() == null) { - messages.addWarningText("A PMD rule without 'ref' attribute can't be imported. see '" + pmdRule.getClazz() + "'"); - continue; - } - Rule rule = ruleFinder.find(RuleQuery.create().withRepositoryKey(PmdConstants.REPOSITORY_KEY).withConfigKey(pmdRule.getRef())); - if (rule != null) { - ActiveRule activeRule = profile.activateRule(rule, PmdLevelUtils.fromLevel(pmdRule.getPriority())); - if (pmdRule.getProperties() != null) { - for (PmdProperty prop : pmdRule.getProperties()) { - if (rule.getParam(prop.getName()) == null) { - messages.addWarningText("The property '" + prop.getName() + "' is not supported in the pmd rule: " + pmdRule.getRef()); - continue; - } - activeRule.setParameter(prop.getName(), prop.getValue()); - } - } - } else { - messages.addWarningText("Unable to import unknown PMD rule '" + pmdRule.getRef() + "'"); - } - } - return profile; - } - - protected PmdRuleset parsePmdRuleset(Reader pmdConfigurationFile, ValidationMessages messages) { - try { - SAXBuilder parser = new SAXBuilder(); - Document dom = parser.build(pmdConfigurationFile); - Element eltResultset = dom.getRootElement(); - Namespace namespace = eltResultset.getNamespace(); - PmdRuleset pmdResultset = new PmdRuleset(); - for (Element eltRule : getChildren(eltResultset, "rule", namespace)) { - PmdRule pmdRule = new PmdRule(eltRule.getAttributeValue("ref")); - pmdRule.setClazz(eltRule.getAttributeValue("class")); - pmdRule.setName(eltRule.getAttributeValue("name")); - pmdRule.setMessage(eltRule.getAttributeValue("message")); - parsePmdPriority(eltRule, pmdRule, namespace); - parsePmdProperties(eltRule, pmdRule, namespace); - pmdResultset.addRule(pmdRule); - } - return pmdResultset; - } catch (Exception e) { - String errorMessage = "The PMD configuration file is not valid"; - messages.addErrorText(errorMessage + " : " + e.getMessage()); - LOG.error(errorMessage, e); - return new PmdRuleset(); - } - } - - private List getChildren(Element parent, String childName, @Nullable Namespace namespace) { - if (namespace == null) { - return parent.getChildren(childName); - } else { - return parent.getChildren(childName, namespace); - } - } - - private void parsePmdProperties(Element eltRule, PmdRule pmdRule, @Nullable Namespace namespace) { - for (Element eltProperties : getChildren(eltRule, "properties", namespace)) { - for (Element eltProperty : getChildren(eltProperties, "property", namespace)) { - pmdRule.addProperty(new PmdProperty(eltProperty.getAttributeValue("name"), eltProperty.getAttributeValue("value"))); - } - } - } - - private void parsePmdPriority(Element eltRule, PmdRule pmdRule, @Nullable Namespace namespace) { - for (Element eltPriority : getChildren(eltRule, "priority", namespace)) { - pmdRule.setPriority(eltPriority.getValue()); - } - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdRuleRepository.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdRuleRepository.java deleted file mode 100644 index 3b91268754b..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdRuleRepository.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import com.google.common.collect.Lists; -import org.sonar.api.platform.ServerFileSystem; -import org.sonar.api.resources.Java; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleRepository; -import org.sonar.api.rules.XMLRuleParser; - -import java.io.File; -import java.util.List; - -public final class PmdRuleRepository extends RuleRepository { - private final ServerFileSystem fileSystem; - private final XMLRuleParser xmlRuleParser; - - public PmdRuleRepository(ServerFileSystem fileSystem, XMLRuleParser xmlRuleParser) { - super(PmdConstants.REPOSITORY_KEY, Java.KEY); - setName(PmdConstants.REPOSITORY_NAME); - this.fileSystem = fileSystem; - this.xmlRuleParser = xmlRuleParser; - } - - @Override - public List createRules() { - List rules = Lists.newArrayList(); - rules.addAll(xmlRuleParser.parse(getClass().getResourceAsStream("/org/sonar/plugins/pmd/rules.xml"))); - for (File userExtensionXml : fileSystem.getExtensions(PmdConstants.REPOSITORY_KEY, "xml")) { - rules.addAll(xmlRuleParser.parse(userExtensionXml)); - } - return rules; - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdSensor.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdSensor.java deleted file mode 100644 index 834679ba52e..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdSensor.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import net.sourceforge.pmd.IRuleViolation; -import net.sourceforge.pmd.Report; -import org.sonar.api.batch.Sensor; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.Java; -import org.sonar.api.resources.Project; -import org.sonar.api.rules.Violation; -import org.sonar.api.utils.XmlParserException; - -import java.util.Iterator; - -public class PmdSensor implements Sensor { - private final RulesProfile profile; - private final PmdExecutor executor; - private final PmdViolationToRuleViolation pmdViolationToRuleViolation; - - public PmdSensor(RulesProfile profile, PmdExecutor executor, PmdViolationToRuleViolation pmdViolationToRuleViolation) { - this.profile = profile; - this.executor = executor; - this.pmdViolationToRuleViolation = pmdViolationToRuleViolation; - } - - public boolean shouldExecuteOnProject(Project project) { - return (!project.getFileSystem().mainFiles(Java.KEY).isEmpty() && !profile.getActiveRulesByRepository(PmdConstants.REPOSITORY_KEY).isEmpty()) - || (!project.getFileSystem().testFiles(Java.KEY).isEmpty() && !profile.getActiveRulesByRepository(PmdConstants.TEST_REPOSITORY_KEY).isEmpty()); - } - - public void analyse(Project project, SensorContext context) { - try { - Report report = executor.execute(); - reportViolations(report.iterator(), context); - } catch (Exception e) { - throw new XmlParserException(e); - } - } - - private void reportViolations(Iterator violations, SensorContext context) { - while (violations.hasNext()) { - IRuleViolation pmdViolation = violations.next(); - - Violation violation = pmdViolationToRuleViolation.toViolation(pmdViolation, context); - if (null != violation) { - context.saveViolation(violation); - } - } - } - - @Override - public String toString() { - return getClass().getSimpleName(); - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdTemplate.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdTemplate.java deleted file mode 100644 index ff16b039b71..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdTemplate.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Functions; -import com.google.common.collect.ImmutableMap; -import com.google.common.io.Closeables; -import net.sourceforge.pmd.PMD; -import net.sourceforge.pmd.PMDException; -import net.sourceforge.pmd.RuleContext; -import net.sourceforge.pmd.RuleSets; -import net.sourceforge.pmd.SourceType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.sonar.api.resources.InputFile; -import org.sonar.api.utils.SonarException; - -import java.io.File; -import java.io.InputStream; -import java.nio.charset.Charset; -import java.util.Map; - -public class PmdTemplate { - private static final Logger LOG = LoggerFactory.getLogger(PmdTemplate.class); - - private static final Map JAVA_VERSIONS = ImmutableMap.of( - "1.1", "1.3", - "1.2", "1.3", - "5", "1.5", - "6", "1.6"); - - private final PMD pmd; - - public PmdTemplate(String javaVersion) { - this(new PMD()); - setJavaVersion(pmd, javaVersion); - } - - @VisibleForTesting - PmdTemplate(PMD pmd) { - this.pmd = pmd; - } - - public void process(InputFile inputFile, Charset encoding, RuleSets rulesets, RuleContext ruleContext) { - File file = inputFile.getFile(); - ruleContext.setSourceCodeFilename(file.getAbsolutePath()); - - InputStream inputStream = null; - try { - inputStream = inputFile.getInputStream(); - - pmd.processFile(inputStream, encoding.displayName(), rulesets, ruleContext); - } catch (PMDException e) { - LOG.error("Fail to execute PMD. Following file is ignored: " + file, e.getCause()); - } catch (Exception e) { - LOG.error("Fail to execute PMD. Following file is ignored: " + file, e); - } finally { - Closeables.closeQuietly(inputStream); - } - } - - @VisibleForTesting - static void setJavaVersion(PMD pmd, String javaVersion) { - String version = normalize(javaVersion); - SourceType sourceType = SourceType.getSourceTypeForId("java " + version); - if (sourceType == null) { - throw new SonarException("Unsupported Java version for PMD: " + version); - } - - LOG.info("Java version: " + version); - pmd.setJavaVersion(sourceType); - } - - private static String normalize(String version) { - return Functions.forMap(JAVA_VERSIONS, version).apply(version); - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdUnitTestsRuleRepository.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdUnitTestsRuleRepository.java deleted file mode 100644 index c76c794a196..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdUnitTestsRuleRepository.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import org.sonar.api.resources.Java; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleRepository; -import org.sonar.api.rules.XMLRuleParser; - -import java.io.InputStream; -import java.util.List; - -public final class PmdUnitTestsRuleRepository extends RuleRepository { - private final XMLRuleParser xmlRuleParser; - - public PmdUnitTestsRuleRepository(XMLRuleParser xmlRuleParser) { - super(PmdConstants.TEST_REPOSITORY_KEY, Java.KEY); - setName(PmdConstants.TEST_REPOSITORY_NAME); - this.xmlRuleParser = xmlRuleParser; - } - - @Override - public List createRules() { - InputStream input = getClass().getResourceAsStream("/org/sonar/plugins/pmd/rules-unit-tests.xml"); - return xmlRuleParser.parse(input); - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdVersion.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdVersion.java deleted file mode 100644 index 0b70b225453..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdVersion.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import com.google.common.io.Closeables; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -public final class PmdVersion { - private static final String PROPERTIES_PATH = "/org/sonar/plugins/pmd/pmd-plugin.properties"; - - private PmdVersion() { - // Static utility class - } - - public static String getVersion() { - Properties properties = new Properties(); - - InputStream input = null; - try { - input = PmdVersion.class.getResourceAsStream(PROPERTIES_PATH); - properties.load(input); - } catch (IOException e) { - LoggerFactory.getLogger(PmdVersion.class).warn("Can not load the PMD version from the file " + PROPERTIES_PATH); - } finally { - Closeables.closeQuietly(input); - } - - return properties.getProperty("pmd.version", ""); - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdViolationToRuleViolation.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdViolationToRuleViolation.java deleted file mode 100644 index 995038f96cf..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdViolationToRuleViolation.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; -import net.sourceforge.pmd.IRuleViolation; -import org.sonar.api.BatchExtension; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.resources.JavaFile; -import org.sonar.api.resources.ProjectFileSystem; -import org.sonar.api.resources.Resource; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleFinder; -import org.sonar.api.rules.Violation; - -import java.io.File; -import java.util.List; - -public class PmdViolationToRuleViolation implements BatchExtension { - private final ProjectFileSystem projectFileSystem; - private final RuleFinder ruleFinder; - - public PmdViolationToRuleViolation(ProjectFileSystem projectFileSystem, RuleFinder ruleFinder) { - this.projectFileSystem = projectFileSystem; - this.ruleFinder = ruleFinder; - } - - public Violation toViolation(IRuleViolation pmdViolation, SensorContext context) { - Resource resource = findResourceFor(pmdViolation); - if (context.getResource(resource) == null) { - return null; // Save violations only for existing resources - } - - Rule rule = findRuleFor(pmdViolation); - if (rule == null) { - return null; // Save violations only for enabled rules - } - - int lineId = pmdViolation.getBeginLine(); - String message = pmdViolation.getDescription(); - - return Violation.create(rule, resource).setLineId(lineId).setMessage(message); - } - - private Resource findResourceFor(IRuleViolation violation) { - List allSources = ImmutableList.copyOf(Iterables.concat(projectFileSystem.getSourceDirs(), projectFileSystem.getTestDirs())); - - return JavaFile.fromAbsolutePath(violation.getFilename(), allSources, true); - } - - private Rule findRuleFor(IRuleViolation violation) { - String ruleKey = violation.getRule().getName(); - Rule rule = ruleFinder.findByKey(PmdConstants.REPOSITORY_KEY, ruleKey); - if (rule != null) { - return rule; - } - return ruleFinder.findByKey(PmdConstants.TEST_REPOSITORY_KEY, ruleKey); - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/SonarWayProfile.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/SonarWayProfile.java deleted file mode 100644 index b21d5d725a8..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/SonarWayProfile.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import com.google.common.io.Closeables; -import org.sonar.api.profiles.ProfileDefinition; -import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.Java; -import org.sonar.api.utils.ValidationMessages; - -import java.io.InputStreamReader; -import java.io.Reader; - -public final class SonarWayProfile extends ProfileDefinition { - private final PmdProfileImporter importer; - - public SonarWayProfile(PmdProfileImporter importer) { - this.importer = importer; - } - - @Override - public RulesProfile createProfile(ValidationMessages validation) { - Reader config = null; - try { - config = new InputStreamReader(this.getClass().getResourceAsStream("/org/sonar/plugins/pmd/profile-sonar-way.xml")); - - RulesProfile profile = importer.importProfile(config, validation); - profile.setLanguage(Java.KEY); - profile.setName(RulesProfile.SONAR_WAY_NAME); - - return profile; - } finally { - Closeables.closeQuietly(config); - } - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/SonarWayWithFindbugsProfile.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/SonarWayWithFindbugsProfile.java deleted file mode 100644 index f2553b80c9d..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/SonarWayWithFindbugsProfile.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import org.sonar.api.profiles.ProfileDefinition; -import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.Java; -import org.sonar.api.utils.ValidationMessages; - -public class SonarWayWithFindbugsProfile extends ProfileDefinition { - private final SonarWayProfile sonarWay; - - public SonarWayWithFindbugsProfile(SonarWayProfile sonarWay) { - this.sonarWay = sonarWay; - } - - @Override - public RulesProfile createProfile(ValidationMessages validation) { - RulesProfile profile = sonarWay.createProfile(validation); - - profile.setName(RulesProfile.SONAR_WAY_FINDBUGS_NAME); - profile.setLanguage(Java.KEY); - - return profile; - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/SunConventionsProfile.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/SunConventionsProfile.java deleted file mode 100644 index aa147db5586..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/SunConventionsProfile.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import com.google.common.io.Closeables; -import org.sonar.api.profiles.ProfileDefinition; -import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.Java; -import org.sonar.api.utils.ValidationMessages; - -import java.io.InputStreamReader; -import java.io.Reader; - -public final class SunConventionsProfile extends ProfileDefinition { - private final PmdProfileImporter importer; - - public SunConventionsProfile(PmdProfileImporter importer) { - this.importer = importer; - } - - @Override - public RulesProfile createProfile(ValidationMessages validation) { - Reader config = null; - try { - config = new InputStreamReader(this.getClass().getResourceAsStream("/org/sonar/plugins/pmd/profile-sun-conventions.xml")); - - RulesProfile profile = importer.importProfile(config, validation); - profile.setLanguage(Java.KEY); - profile.setName(RulesProfile.SUN_CONVENTIONS_NAME); - - return profile; - } finally { - Closeables.closeQuietly(config); - } - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/package-info.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/package-info.java deleted file mode 100644 index b3da6c0c70f..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/package-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ - -@ParametersAreNonnullByDefault -package org.sonar.plugins.pmd; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdProperty.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdProperty.java deleted file mode 100644 index 6355cb3d2cb..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdProperty.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd.xml; - -public class PmdProperty { - - private String name; - - private String value; - - private String cdataValue; - - public PmdProperty(String name, String value) { - this.name = name; - this.value = value; - } - - public String getName() { - return name; - } - - public String getValue() { - return value; - } - - public String getCdataValue() { - return cdataValue; - } - - public boolean isCdataValue(){ - return cdataValue != null; - } - - public void setValue(String value) { - this.value = value; - } - - public void setCdataValue(String cdataValue) { - this.cdataValue = cdataValue; - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdRule.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdRule.java deleted file mode 100644 index c18ec4d5162..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdRule.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd.xml; - -import java.util.ArrayList; -import java.util.List; - -public class PmdRule { - - private String ref; - - private String priority; - - private String name; - - private String message; - - private List properties = new ArrayList(); - - private String clazz; - - public PmdRule(String ref) { - this(ref, null); - } - - public PmdRule(String ref, String priority) { - this.ref = ref; - this.priority = priority; - } - - public String getRef() { - return ref; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - public List getProperties() { - return properties; - } - - public PmdProperty getProperty(String propertyName) { - for (PmdProperty prop : properties) { - if (propertyName.equals(prop.getName())) { - return prop; - } - } - return null; - } - - public int compareTo(String o) { - return o.compareTo(ref); - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public void addProperty(PmdProperty property) { - if (properties == null) { - properties = new ArrayList(); - } - properties.add(property); - } - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setMessage(String message) { - this.message = message; - } - - public String getMessage() { - return message; - } - - public void setClazz(String clazz) { - this.clazz = clazz; - } - - public String getClazz() { - return clazz; - } - - public void setRef(String ref) { - this.ref = ref; - } - - public void removeProperty(String propertyName) { - PmdProperty prop = getProperty(propertyName); - properties.remove(prop); - } - - public boolean hasProperties() { - return properties != null && !properties.isEmpty(); - } -} diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdRuleset.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdRuleset.java deleted file mode 100644 index d70deed68d8..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/xml/PmdRuleset.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd.xml; - -import java.util.ArrayList; -import java.util.List; - -public class PmdRuleset { - - private String description; - - private List rules = new ArrayList(); - - public PmdRuleset() { - } - - public PmdRuleset(String description) { - this.description = description; - } - - public List getPmdRules() { - return rules; - } - - public void setRules(List rules) { - this.rules = rules; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public void addRule(PmdRule rule) { - rules.add(rule); - } - -} diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd.properties b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd.properties deleted file mode 100644 index af3beb3b70a..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd.properties +++ /dev/null @@ -1,287 +0,0 @@ -rule.pmd.StringInstantiation.name=String Instantiation -rule.pmd.RemoteInterfaceNamingConvention.name=Remote Interface Naming Convention -rule.pmd.InefficientEmptyStringCheck.name=Inefficient Empty String Check -rule.pmd.DoubleCheckedLocking.name=Double checked locking -rule.pmd.EmptyStaticInitializer.name=Empty Static Initializer -rule.pmd.DoNotThrowExceptionInFinally.name=Strict Exception - Do not throw exception in finally -rule.pmd.SignatureDeclareThrowsException.name=Signature Declare Throws Exception -rule.pmd.UseEqualsToCompareStrings.name=Use Equals To Compare Strings -rule.pmd.VariableNamingConventions.name=Naming - Variable naming conventions -rule.pmd.VariableNamingConventions.param.memberSuffix=A suffix for member variables -rule.pmd.VariableNamingConventions.param.memberPrefix=A prefix for member variables -rule.pmd.VariableNamingConventions.param.staticSuffix=A suffix for static variables -rule.pmd.VariableNamingConventions.param.staticPrefix=A prefix for static variables -rule.pmd.PositionLiteralsFirstInComparisons.name=Position Literals First In Comparisons -rule.pmd.ConfusingTernary.name=Confusing Ternary -rule.pmd.ShortMethodName.name=Naming - Short method name -rule.pmd.UncommentedEmptyConstructor.name=Uncommented Empty Constructor -rule.pmd.UncommentedEmptyConstructor.param.ignoreExplicitConstructorInvocation=Ignore explicit constructor invocation when deciding whether constructor is empty or not. Default is false. -rule.pmd.UnusedFormalParameter.name=Unused formal parameter -rule.pmd.ExcessiveParameterList.name=Excessive Parameter List -rule.pmd.ExcessiveParameterList.param.minimum=The parameter count reporting threshold. Default is 10. -rule.pmd.OnlyOneReturn.name=Only One Return -rule.pmd.UseStringBufferForStringAppends.name=Use String Buffer For String Appends -rule.pmd.BooleanInversion.name=Boolean Inversion -rule.pmd.AvoidDollarSigns.name=Naming - Avoid dollar signs -rule.pmd.AvoidUsingShortType.name=Avoid Using Short Type -rule.pmd.NonCaseLabelInSwitchStatement.name=Non Case Label In Switch Statement -rule.pmd.CyclomaticComplexity.name=Code size - cyclomatic complexity -rule.pmd.CyclomaticComplexity.param.showMethodsComplexity=Indicate if method average violation should be added to the report. Default is true. -rule.pmd.CyclomaticComplexity.param.showClassesComplexity=Indicate if class average violation should be added to the report. Default is true. -rule.pmd.CyclomaticComplexity.param.reportLevel=The Cyclomatic Complexity reporting threshold. Default is 10. -rule.pmd.AvoidEnumAsIdentifier.name=Avoid Enum As Identifier -rule.pmd.AvoidFieldNameMatchingMethodName.name=Naming - Avoid field name matching method name -rule.pmd.InstantiationToGetClass.name=Instantiation To Get Class -rule.pmd.SuspiciousHashcodeMethodName.name=Naming - Suspicious Hashcode method name -rule.pmd.MDBAndSessionBeanNamingConvention.name=Message Driven Bean And Session Bean Naming Convention -rule.pmd.UselessOperationOnImmutable.name=Useless Operation On Immutable -rule.pmd.ReturnEmptyArrayRatherThanNull.name=Return empty array rather than null -rule.pmd.LongInstantiation.name=Java5 migration - Long instantiation -rule.pmd.ExcessiveImports.name=Coupling - excessive imports -rule.pmd.ExcessiveImports.param.minimum=The import count reporting threshold. Default is 30. -rule.pmd.StringBufferInstantiationWithChar.name=String Buffer Instantiation With Char -rule.pmd.StringToString.name=String To String -rule.pmd.MissingSerialVersionUID.name=Missing Serial Version UID -rule.pmd.UnconditionalIfStatement.name=Unconditional If Statement -rule.pmd.AvoidArrayLoops.name=Avoid Array Loops -rule.pmd.ShortVariable.name=Short Variable -rule.pmd.UnusedLocalVariable.name=Unused local variable -rule.pmd.SuspiciousConstantFieldName.name=Naming - Suspicious constant field name -rule.pmd.UseArrayListInsteadOfVector.name=Use Array List Instead Of Vector -rule.pmd.CallSuperLast.name=Android - call super last -rule.pmd.SimplifyBooleanExpressions.name=Avoid unnecessary comparisons in boolean expressions -rule.pmd.FinalizeOnlyCallsSuperFinalize.name=Finalize Only Calls Super Finalize -rule.pmd.ImmutableField.name=Immutable Field -rule.pmd.BooleanInstantiation.name=Boolean Instantiation -rule.pmd.StaticEJBFieldShouldBeFinal.name=Static EJB Field Should Be Final -rule.pmd.AvoidFieldNameMatchingTypeName.name=Naming - Avoid field name matching type name -rule.pmd.OverrideBothEqualsAndHashcode.name=Override both equals and hashcode -rule.pmd.BrokenNullCheck.name=Broken Null Check -rule.pmd.NPathComplexity.name=NPath complexity -rule.pmd.NPathComplexity.param.minimum=The npath reporting threshold. Default is 200. -rule.pmd.CouplingBetweenObjects.name=Coupling between objects -rule.pmd.CouplingBetweenObjects.param.threshold=The unique type reporting threshold. Default is 20. -rule.pmd.IntegerInstantiation.name=Integer Instantiation -rule.pmd.DoNotCallGarbageCollectionExplicitly.name=Do not call garbage collection explicitly -rule.pmd.BeanMembersShouldSerialize.name=Bean Members Should Serialize -rule.pmd.BeanMembersShouldSerialize.param.prefix=A variable prefix to skip, i.e., m_ -rule.pmd.IdempotentOperations.name=Idempotent Operations -rule.pmd.NcssTypeCount.name=Ncss Type Count -rule.pmd.NcssTypeCount.param.minimum=The type NCSS count reporting threshold. Default is 1500. -rule.pmd.AvoidThrowingRawExceptionTypes.name=Avoid Throwing Raw Exception Types -rule.pmd.ImportFromSamePackage.name=Import From Same Package -rule.pmd.UnnecessaryLocalBeforeReturn.name=Unnecessary Local Before Return -rule.pmd.IfElseStmtsMustUseBraces.name=If Else Stmts Must Use Braces -rule.pmd.ForLoopsMustUseBraces.name=For Loops Must Use Braces -rule.pmd.UseIndexOfChar.name=Use Index Of Char -rule.pmd.EmptyMethodInAbstractClassShouldBeAbstract.name=Empty Method In Abstract Class Should Be Abstract -rule.pmd.LongVariable.name=Long Variable -rule.pmd.LongVariable.param.minimum=The variable length reporting threshold. Default is 17. -rule.pmd.MissingBreakInSwitch.name=Missing Break In Switch -rule.pmd.UnnecessaryParentheses.name=Unnecessary parentheses -rule.pmd.MisleadingVariableName.name=Naming - Misleading variable name -rule.pmd.AbstractClassWithoutAnyMethod.name=Abstract class without any methods -rule.pmd.DoNotCallSystemExit.name=Do Not Call System Exit -rule.pmd.AvoidThrowingNullPointerException.name=Avoid Throwing Null Pointer Exception -rule.pmd.EmptySynchronizedBlock.name=Empty Synchronized Block -rule.pmd.SwitchStmtsShouldHaveDefault.name=Switch statements should have default -rule.pmd.UseNotifyAllInsteadOfNotify.name=Use Notify All Instead Of Notify -rule.pmd.UnusedPrivateMethod.name=Unused private method -rule.pmd.MoreThanOneLogger.name=More Than One Logger -rule.pmd.EmptyTryBlock.name=Empty Try Block -rule.pmd.AvoidDeeplyNestedIfStmts.name=Avoid Deeply Nested If Stmts -rule.pmd.AvoidDeeplyNestedIfStmts.param.problemDepth=The if statement depth reporting threshold. Default is 3. -rule.pmd.LocalHomeNamingConvention.name=Local Home Naming Convention -rule.pmd.AvoidUsingNativeCode.name=Avoid Using Native Code -rule.pmd.LooseCoupling.name=Loose coupling -rule.pmd.FinalizeOverloaded.name=Finalize Overloaded -rule.pmd.AvoidThreadGroup.name=Avoid Thread Group -rule.pmd.UnnecessaryConstructor.name=Unnecessary constructor -rule.pmd.LocalVariableCouldBeFinal.name=Local variable could be final -rule.pmd.MethodArgumentCouldBeFinal.name=Method Argument Could Be Final -rule.pmd.AvoidAssertAsIdentifier.name=Avoid Assert As Identifier -rule.pmd.SuspiciousOctalEscape.name=Suspicious Octal Escape -rule.pmd.ByteInstantiation.name=Java5 migration - Byte instantiation -rule.pmd.AvoidConstantsInterface.name=Avoid Constants Interface -rule.pmd.LocalInterfaceSessionNamingConvention.name=Local Interface Session Naming Convention -rule.pmd.CloneMethodMustImplementCloneable.name=Clone method must implement Cloneable -rule.pmd.MethodWithSameNameAsEnclosingClass.name=Naming - Method with same name as enclosing class -rule.pmd.ConsecutiveLiteralAppends.name=Consecutive Literal Appends -rule.pmd.ConsecutiveLiteralAppends.param.threshold=The report threshold. Default is 1. -rule.pmd.CallSuperInConstructor.name=Call Super In Constructor -rule.pmd.SimplifyConditional.name=Simplify Conditional -rule.pmd.InefficientStringBuffering.name=Inefficient String Buffering -rule.pmd.EmptyStatementNotInLoop.name=Empty Statement Not In Loop -rule.pmd.AvoidSynchronizedAtMethodLevel.name=Avoid Synchronized At Method Level -rule.pmd.NcssMethodCount.name=Ncss Method Count -rule.pmd.NcssMethodCount.param.minimum=The method NCSS count reporting threshold. Default is 100. -rule.pmd.AbstractClassWithoutAbstractMethod.name=Abstract Class Without Abstract Method -rule.pmd.AbstractNaming.name=Abstract naming -rule.pmd.DoNotExtendJavaLangError.name=Do Not Extend Java Lang Error -rule.pmd.NoPackage.name=No package -rule.pmd.ExcessiveMethodLength.name=Excessive Method Length -rule.pmd.ExcessiveMethodLength.param.minimum=The method size reporting threshold. Default is 100. -rule.pmd.SwitchDensity.name=Switch Density -rule.pmd.SwitchDensity.param.minimum=The switch statement ratio reporting threshold. Default is 10. -rule.pmd.UseLocaleWithCaseConversions.name=Use Locale With Case Conversions -rule.pmd.DuplicateImports.name=Duplicate Imports -rule.pmd.ProperLogger.name=Proper Logger -rule.pmd.ProperLogger.param.staticLoggerName=Default is LOG -rule.pmd.PreserveStackTrace.name=Preserve Stack Trace -rule.pmd.FinalizeDoesNotCallSuperFinalize.name=Finalize Does Not Call Super Finalize -rule.pmd.DontImportSun.name=Dont Import Sun -rule.pmd.ReplaceVectorWithList.name=Replace Vector With List -rule.pmd.ClassNamingConventions.name=Naming - Class naming conventions -rule.pmd.UncommentedEmptyMethod.name=Uncommented Empty Method -rule.pmd.AvoidAccessibilityAlteration.name=Avoid Accessibility Alteration -rule.pmd.IfStmtsMustUseBraces.name=If Stmts Must Use Braces -rule.pmd.AvoidReassigningParameters.name=Avoid Reassigning Parameters -rule.pmd.OptimizableToArrayCall.name=Optimizable To Array Call -rule.pmd.FinalizeShouldBeProtected.name=Finalize Should Be Protected -rule.pmd.AddEmptyString.name=Add Empty String -rule.pmd.EmptyFinallyBlock.name=Empty Finally Block -rule.pmd.EqualsNull.name=Equals Null -rule.pmd.SuspiciousEqualsMethodName.name=Naming - Suspicious equals method name -rule.pmd.UnnecessaryWrapperObjectCreation.name=Unnecessary Wrapper Object Creation -rule.pmd.AvoidStringBufferField.name=Avoid StringBuffer field -rule.pmd.SimplifyBooleanReturns.name=Simplify boolean returns -rule.pmd.DefaultLabelNotLastInSwitchStmt.name=Default label not last in switch statement -rule.pmd.AvoidUsingOctalValues.name=Avoid Using Octal Values -rule.pmd.AvoidCallingFinalize.name=Avoid Calling Finalize -rule.pmd.ExcessiveClassLength.name=Excessive Class Length -rule.pmd.ExcessiveClassLength.param.minimum=The class size reporting threshold. Default is 1000. -rule.pmd.FinalFieldCouldBeStatic.name=Final Field Could Be Static -rule.pmd.AvoidRethrowingException.name=Avoid Rethrowing Exception -rule.pmd.AvoidUsingHardCodedIP.name=Avoid Using Hard Coded IP -rule.pmd.AvoidUsingHardCodedIP.param.pattern=Regular Expression. Default is ^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ -rule.pmd.ProtectLogD.name=Android - Protect LOGD -rule.pmd.ProtectLogV.name=Android - Protect LOGV -rule.pmd.MethodNamingConventions.name=Naming - Method naming conventions -rule.pmd.NonStaticInitializer.name=Non Static Initializer -rule.pmd.AvoidProtectedFieldInFinalClass.name=Avoid Protected Field In Final Class -rule.pmd.CompareObjectsWithEquals.name=Compare Objects With Equals -rule.pmd.SystemPrintln.name=System Println -rule.pmd.XPathRule.name=XPath rule template -rule.pmd.XPathRule.param.message=Message to display when a violation occurs. -rule.pmd.XPathRule.param.xpath=XPath expressions. -rule.pmd.DontImportJavaLang.name=Dont Import Java Lang -rule.pmd.TooManyMethods.name=Too many methods -rule.pmd.TooManyMethods.param.maxmethods=The method count reporting threshold. Default is 10. -rule.pmd.CloneThrowsCloneNotSupportedException.name=Clone Throws Clone Not Supported Exception -rule.pmd.EmptyCatchBlock.name=Empty Catch Block -rule.pmd.EmptyCatchBlock.param.allowCommentedBlocks=Empty blocks containing comments will be skipped. Default is false. -rule.pmd.CollapsibleIfStatements.name=Collapsible If Statements -rule.pmd.ForLoopShouldBeWhileLoop.name=For Loop Should Be While Loop -rule.pmd.UseCorrectExceptionLogging.name=Use Correct Exception Logging -rule.pmd.ReplaceEnumerationWithIterator.name=Replace Enumeration With Iterator -rule.pmd.EmptyWhileStmt.name=Empty While Stmt -rule.pmd.ReplaceHashtableWithMap.name=Replace Hashtable With Map -rule.pmd.AvoidMultipleUnaryOperators.name=Avoid Multiple Unary Operators -rule.pmd.UselessOverridingMethod.name=Useless Overriding Method -rule.pmd.UselessOverridingMethod.param.ignoreAnnotations=Ignore annotations. Default is false. -rule.pmd.SimpleDateFormatNeedsLocale.name=Simple Date Format Needs Locale -rule.pmd.UnnecessaryFinalModifier.name=Unnecessary Final Modifier -rule.pmd.CallSuperFirst.name=Android - call super first -rule.pmd.UseArraysAsList.name=Use Arrays As List -rule.pmd.CloseResource.name=Close Resource -rule.pmd.CloseResource.param.closeTargets=Methods which may close this resource. Default is 'close'. -rule.pmd.CloseResource.param.types=Resources to check. Default value is 'Connection,Statement,ResultSet', -rule.pmd.EmptySwitchStatements.name=Empty Switch Statements -rule.pmd.AccessorClassGeneration.name=Accessor Class Generation -rule.pmd.PackageCase.name=Package case -rule.pmd.TooFewBranchesForASwitchStatement.name=Too few branches for a switch statement -rule.pmd.TooFewBranchesForASwitchStatement.param.minimumNumberCaseForASwitch=Minimum number of branches for a switch. Default is 3. -rule.pmd.TooManyStaticImports.name=Too Many Static Imports -rule.pmd.TooManyStaticImports.param.maximumStaticImports=All static imports can be disallowed by setting this to 0. Default is 4. -rule.pmd.EmptyIfStmt.name=Empty If Stmt -rule.pmd.DataflowAnomalyAnalysis.name=Dataflow Anomaly Analysis -rule.pmd.DataflowAnomalyAnalysis.param.maxviolations=The maximum number of violations per class. Default is 100. -rule.pmd.DataflowAnomalyAnalysis.param.maxpaths=The maximum number of checked paths per method. A lower value will increase the performance of the rule but may decrease the number of found anomalies. Default is 1000. -rule.pmd.NonThreadSafeSingleton.name=Non Thread Safe Singleton -rule.pmd.NonThreadSafeSingleton.param.checkNonStaticFields=Do not set this to true and checkNonStaticMethods to false. Default is false. -rule.pmd.NonThreadSafeSingleton.param.checkNonStaticMethods=Do not set this to false and checkNonStaticFields to true. Default is true. -rule.pmd.WhileLoopsMustUseBraces.name=While Loops Must Use Braces -rule.pmd.UnusedModifier.name=Unused Modifier -rule.pmd.ClassCastExceptionWithToArray.name=Class Cast Exception With To Array -rule.pmd.EmptyInitializer.name=Basic - Empty Initializer -rule.pmd.DoNotUseThreads.name=Do Not Use Threads -rule.pmd.InsufficientStringBufferDeclaration.name=Insufficient String Buffer Declaration -rule.pmd.AvoidUsingVolatile.name=Avoid Using Volatile -rule.pmd.UseStringBufferLength.name=Use String Buffer Length -rule.pmd.AvoidInstantiatingObjectsInLoops.name=Avoid instantiating objects in loops -rule.pmd.UnsynchronizedStaticDateFormatter.name=Unsynchronized Static Date Formatter -rule.pmd.MissingStaticMethodInNonInstantiatableClass.name=Missing Static Method In Non Instantiatable Class -rule.pmd.EmptyFinalizer.name=Empty Finalizer -rule.pmd.ShortInstantiation.name=Java5 migration - Short instantiation -rule.pmd.ConstructorCallsOverridableMethod.name=Constructor Calls Overridable Method -rule.pmd.DefaultPackage.name=Default Package -rule.pmd.NcssConstructorCount.name=Ncss Constructor Count -rule.pmd.NcssConstructorCount.param.minimum=The constructor NCSS count reporting threshold. Default is 100. -rule.pmd.AvoidCatchingThrowable.name=Avoid Catching Throwable -rule.pmd.AvoidDecimalLiteralsInBigDecimalConstructor.name=Avoid Decimal Literals In Big Decimal Constructor -rule.pmd.AvoidDuplicateLiterals.name=Avoid Duplicate Literals -rule.pmd.AvoidDuplicateLiterals.param.separator=Separator used in the exceptionlist. Default is , -rule.pmd.AvoidDuplicateLiterals.param.skipAnnotations=Skip literals within Annotations. Default is false. -rule.pmd.AvoidDuplicateLiterals.param.exceptionfile=File containing strings to skip (one string per line), only used if exceptionlist is not set. -rule.pmd.AvoidDuplicateLiterals.param.threshold=The number of duplicate literals reporting threshold. Default is 4. -rule.pmd.AvoidDuplicateLiterals.param.exceptionlist=Strings in that list are skipped. -rule.pmd.ExcessivePublicCount.name=Excessive Public Count -rule.pmd.ExcessivePublicCount.param.minimum=The public item reporting threshold. Default is 45. -rule.pmd.ClassWithOnlyPrivateConstructorsShouldBeFinal.name=Class with only private constructors should be final -rule.pmd.NullAssignment.name=Null Assignment -rule.pmd.MisplacedNullCheck.name=Misplaced Null Check -rule.pmd.SingularField.name=Singular Field -rule.pmd.UnusedImports.name=Unused imports -rule.pmd.UselessStringValueOf.name=Useless String Value Of -rule.pmd.UnusedNullCheckInEquals.name=Unused Null Check In Equals -rule.pmd.AvoidCatchingNPE.name=Avoid Catching NPE -rule.pmd.DontNestJsfInJstlIteration.name=Dont Nest Jsf In Jstl Iteration -rule.pmd.CheckResultSet.name=Check ResultSet -rule.pmd.ReturnFromFinallyBlock.name=Return From Finally Block -rule.pmd.UseProperClassLoader.name=Use Proper Class Loader -rule.pmd.UseSingleton.name=Use Singleton -rule.pmd.ProperCloneImplementation.name=Proper clone implementation -rule.pmd.UseCollectionIsEmpty.name=Use Collection Is Empty -rule.pmd.AvoidThrowingNewInstanceOfSameException.name=Strict Exception - Avoid throwing new instance of same exception -rule.pmd.SimplifyStartsWith.name=Simplify Starts With -rule.pmd.AvoidFinalLocalVariable.name=Avoid Final Local Variable -rule.pmd.TooManyFields.name=Too Many Fields -rule.pmd.TooManyFields.param.maxfields=The field count reporting threshold. Default is 15. -rule.pmd.MethodReturnsInternalArray.name=Security - Method returns internal array -rule.pmd.AvoidInstanceofChecksInCatchClause.name=Avoid Instanceof Checks In Catch Clause -rule.pmd.LoggerIsNotStaticFinal.name=Logger Is Not Static Final -rule.pmd.BigIntegerInstantiation.name=Big Integer Instantiation -rule.pmd.AssignmentInOperand.name=Assignment In Operand -rule.pmd.BadComparison.name=Bad Comparison -rule.pmd.UnnecessaryReturn.name=Unnecessary Return -rule.pmd.AssignmentToNonFinalStatic.name=Assignment To Non Final Static -rule.pmd.UnnecessaryConversionTemporary.name=Unnecessary Conversion Temporary -rule.pmd.JumbledIncrementer.name=Jumbled Incrementer -rule.pmd.BooleanGetMethodName.name=Boolean Get Method Name -rule.pmd.BooleanGetMethodName.param.checkParameterizedMethods=Check parameterized methods. Default is false. -rule.pmd.AvoidPrintStackTrace.name=Avoid Print Stack Trace -rule.pmd.RemoteSessionInterfaceNamingConvention.name=Remote Session Interface Naming Convention -rule.pmd.UnnecessaryCaseChange.name=Unnecessary Case Change -rule.pmd.ArrayIsStoredDirectly.name=Security - Array is stored directly -rule.pmd.ExceptionAsFlowControl.name=Exception As Flow Control -rule.pmd.UnusedPrivateField.name=Unused Private Field -rule.pmd.AtLeastOneConstructor.name=At Least One Constructor -rule.pmd.AppendCharacterWithChar.name=Append Character With Char -rule.pmd.GenericsNaming.name=Generics Naming -rule.pmd.AvoidCatchingGenericException.name=Avoid Catching Generic Exception -rule.pmd.AvoidLosingExceptionInformation.name=Avoid Losing Exception Information -rule.pmd.AvoidLiteralsInIfCondition.name=Avoid Literals In If Condition -rule.pmd.UseConcurrentHashMap.name=Use ConcurrentHashMap -rule.pmd.DoNotHardCodeSDCard.name=Android - Do Not Hard Code SD Card -rule.pmd.DontCallThreadRun.name=Dont Call Thread Run -rule.pmd.GuardDebugLogging.name=Guard Debug Logging -rule.pmd-unit-tests.JUnitStaticSuite.name=JUnit static suite -rule.pmd-unit-tests.JUnitSpelling.name= JUnit spelling -rule.pmd-unit-tests.JUnitAssertionsShouldIncludeMessage.name=JUnit assertions should include a message -rule.pmd-unit-tests.JUnitTestsShouldIncludeAssert.name=JUnit tests should include an assert -rule.pmd-unit-tests.TestClassWithoutTestCases.name=Test class without test cases (JUnit 3.x only) -rule.pmd-unit-tests.UnnecessaryBooleanAssertion.name=Unnecessary boolean assertion -rule.pmd-unit-tests.UseAssertEqualsInsteadOfAssertTrue.name=Use assertEquals instead of assertTrue -rule.pmd-unit-tests.UseAssertSameInsteadOfAssertTrue.name=Use assertSame instead of assertTrue -rule.pmd-unit-tests.UseAssertNullInsteadOfAssertTrue.name=Use assertNull instead of assertTrue -rule.pmd-unit-tests.SimplifyBooleanAssertion.name=Simplify boolean assertion diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitAssertionsShouldIncludeMessage.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitAssertionsShouldIncludeMessage.html deleted file mode 100644 index ec742d69cc4..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitAssertionsShouldIncludeMessage.html +++ /dev/null @@ -1,8 +0,0 @@ -JUnit assertions should include a message - i.e., use the three argument version of assertEquals(), not the two argument version. -
-public class Foo extends TestCase {
-  public void testSomething() {
-    assertEquals("foo", "bar"); // violation, should be assertEquals("Foo does not equals bar", "foo", "bar");
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitSpelling.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitSpelling.html deleted file mode 100644 index 48bdfb21fa3..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitSpelling.html +++ /dev/null @@ -1,9 +0,0 @@ -Some JUnit framework methods are easy to misspell. -
-import junit.framework.*;
-
-public class Foo extends TestCase {
-  public void setup() {} // violation, should be setUp()
-  public void TearDown() {} // violation, should be tearDown()
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitStaticSuite.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitStaticSuite.html deleted file mode 100644 index 916d6dea758..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitStaticSuite.html +++ /dev/null @@ -1,9 +0,0 @@ -The suite() method in a JUnit test needs to be both public and static. -
-import junit.framework.*;
-
-public class Foo extends TestCase {
-  public void suite() {} // violation, should be static
-  private static void suite() {} // violation, should be public
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitTestsShouldIncludeAssert.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitTestsShouldIncludeAssert.html deleted file mode 100644 index ad6b1256de4..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/JUnitTestsShouldIncludeAssert.html +++ /dev/null @@ -1,10 +0,0 @@ -JUnit tests should include at least one assertion. This makes the tests more robust, and using assert with messages provide the developer a clearer idea of what the test does. -
-public class Foo extends TestCase {
-  public void testSomething() {
-    Bar b = findBar();
-    b.work();
-    // violation, we could use assertNotNull("bar not found", b);
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/SimplifyBooleanAssertion.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/SimplifyBooleanAssertion.html deleted file mode 100644 index 093b4fcef89..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/SimplifyBooleanAssertion.html +++ /dev/null @@ -1,9 +0,0 @@ -Avoid negation in an assertTrue or assertFalse test. For example, rephrase: assertTrue(!expr); as: assertFalse(expr); -
-public class SimpleTest extends TestCase {
-  public void testX() {
-    assertTrue("not empty", !r.isEmpty()); // violation, replace with assertFalse("not empty", r.isEmpty())
-    assertFalse(!r.isEmpty()); // violation, replace with assertTrue("empty", r.isEmpty())
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/TestClassWithoutTestCases.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/TestClassWithoutTestCases.html deleted file mode 100644 index 25a0699331c..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/TestClassWithoutTestCases.html +++ /dev/null @@ -1,10 +0,0 @@ -Test classes end with the suffix Test. Having a non-test class with that name is not a good practice, since most people will assume it is a test case. Test classes have test methods named testXXX. -Beware: This rule doesn't support JUnit 4.x's @Test annotation. -
-public class CarTest { // violation, consider changing the name of the class if it is not a test
-  // consider adding test methods if it is a test
-  public static void main(String[] args) {
-    // do something
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UnnecessaryBooleanAssertion.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UnnecessaryBooleanAssertion.html deleted file mode 100644 index 83356d46679..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UnnecessaryBooleanAssertion.html +++ /dev/null @@ -1,7 +0,0 @@ -A JUnit test assertion with a boolean literal is unnecessary since it always will eval to the same thing. Consider using flow control (in case of assertTrue(false) or similar) or simply removing statements like assertTrue(true) and assertFalse(false). If you just want a test to halt, use the fail method. -
-public class SimpleTest extends TestCase {
-  public void testX() {
-    assertTrue(true); // violation
-  }
-}
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UseAssertEqualsInsteadOfAssertTrue.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UseAssertEqualsInsteadOfAssertTrue.html deleted file mode 100644 index 0887fb74827..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UseAssertEqualsInsteadOfAssertTrue.html +++ /dev/null @@ -1,10 +0,0 @@ -This rule detects JUnit assertions in object equality. These assertions should be made by more specific methods, like assertEquals. -
-public class FooTest extends TestCase {
-  void testCode() {
-    Object a, b;
-
-    assertTrue(a.equals(b)); // violation
-    assertEquals("a should equals b", a, b); // good usage
-  }
-}
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UseAssertNullInsteadOfAssertTrue.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UseAssertNullInsteadOfAssertTrue.html deleted file mode 100644 index 947ebd5bde9..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UseAssertNullInsteadOfAssertTrue.html +++ /dev/null @@ -1,13 +0,0 @@ -This rule detects JUnit assertions in object references equality. These assertions should be made by more specific methods, like assertNull, assertNotNull. -
-public class FooTest extends TestCase {
-  void testCode() {
-    Object a = doSomething();
-
-    assertTrue(a==null); // violation
-    assertNull(a);  // good usage
-    assertTrue(a != null); // violation
-    assertNotNull(a);  // good usage
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UseAssertSameInsteadOfAssertTrue.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UseAssertSameInsteadOfAssertTrue.html deleted file mode 100644 index d2d317b37f8..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd-unit-tests/UseAssertSameInsteadOfAssertTrue.html +++ /dev/null @@ -1,11 +0,0 @@ -This rule detects JUnit assertions in object references equality. These assertions should be made by more specific methods, like assertSame, assertNotSame. -
-public class FooTest extends TestCase {
-  void testCode() {
-    Object a, b;
-
-    assertTrue(a==b); // violation
-    assertSame(a, b); // good usage
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AbstractClassWithoutAbstractMethod.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AbstractClassWithoutAbstractMethod.html deleted file mode 100644 index 4803024f611..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AbstractClassWithoutAbstractMethod.html +++ /dev/null @@ -1 +0,0 @@ -The abstract class does not contain any abstract methods. An abstract class suggests an incomplete implementation, which is to be completed by subclasses implementing the abstract methods. If the class is intended to be used as a base class only (not to be instantiated direcly) a protected constructor can be provided prevent direct instantiation. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AbstractClassWithoutAnyMethod.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AbstractClassWithoutAnyMethod.html deleted file mode 100644 index 60007876353..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AbstractClassWithoutAnyMethod.html +++ /dev/null @@ -1,7 +0,0 @@ -If the abstract class does not provides any methods, it may be just a data container that is not to be instantiated. In this case, it's probably better to use a private or a protected constructor in order to prevent instantiation than make the class misleadingly abstract. Example : -
-public class abstract Example {
-	String field;
-	int otherField;
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AbstractNaming.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AbstractNaming.html deleted file mode 100644 index e65a17b09c8..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AbstractNaming.html +++ /dev/null @@ -1,5 +0,0 @@ -Abstract classes should be named 'AbstractXXX'. Example : -
-public abstract class Foo { // should be AbstractFoo
-}
-  
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AccessorClassGeneration.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AccessorClassGeneration.html deleted file mode 100644 index 038e55aa6b8..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AccessorClassGeneration.html +++ /dev/null @@ -1 +0,0 @@ -Instantiation by way of private constructors from outside of the constructor's class often causes the generation of an accessor. A factory method, or non-privitization of the constructor can eliminate this situation. The generated class file is actually an interface. It gives the accessing class the ability to invoke a new hidden package scope constructor that takes the interface as a supplementary parameter. This turns a private constructor effectively into one with package scope, and is challenging to discern. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AddEmptyString.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AddEmptyString.html deleted file mode 100644 index b7e61ab2a52..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AddEmptyString.html +++ /dev/null @@ -1 +0,0 @@ -Finds empty string literals which are being added. This is an inefficient way to convert any type to a String. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AppendCharacterWithChar.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AppendCharacterWithChar.html deleted file mode 100644 index a0e5ddf0d23..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AppendCharacterWithChar.html +++ /dev/null @@ -1 +0,0 @@ -Avoid concatenating characters as strings in StringBuffer.append. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ArrayIsStoredDirectly.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ArrayIsStoredDirectly.html deleted file mode 100644 index 6246b248427..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ArrayIsStoredDirectly.html +++ /dev/null @@ -1 +0,0 @@ -Constructors and methods receiving arrays should clone objects and store the copy. This prevents that future changes from the user affect the internal functionality. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AssignmentInOperand.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AssignmentInOperand.html deleted file mode 100644 index 1fe4c4f83f2..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AssignmentInOperand.html +++ /dev/null @@ -1 +0,0 @@ -Avoid assignments in operands; this can make code more complicated and harder to read. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AssignmentToNonFinalStatic.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AssignmentToNonFinalStatic.html deleted file mode 100644 index efde9459fc9..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AssignmentToNonFinalStatic.html +++ /dev/null @@ -1 +0,0 @@ -Identifies a possible unsafe usage of a static field. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AtLeastOneConstructor.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AtLeastOneConstructor.html deleted file mode 100644 index 85d0b140de8..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AtLeastOneConstructor.html +++ /dev/null @@ -1 +0,0 @@ -Each class should declare at least one constructor. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidAccessibilityAlteration.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidAccessibilityAlteration.html deleted file mode 100644 index 8f2c0a1cb71..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidAccessibilityAlteration.html +++ /dev/null @@ -1 +0,0 @@ -Methods such as getDeclaredConstructors(), getDeclaredConstructor(Class[]) and setAccessible(), as the interface PrivilegedAction, allow to alter, at runtime, the visilibilty of variable, classes, or methods, even if they are private. Obviously, no one should do so, as such behavior is against everything encapsulation principal stands for. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidArrayLoops.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidArrayLoops.html deleted file mode 100644 index e0a56e2d2df..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidArrayLoops.html +++ /dev/null @@ -1 +0,0 @@ -Instead of copying data between two arrays, use System.arrayCopy method \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidAssertAsIdentifier.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidAssertAsIdentifier.html deleted file mode 100644 index c9ae976fc34..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidAssertAsIdentifier.html +++ /dev/null @@ -1 +0,0 @@ -Finds all places 'assert' is used as an identifier is used. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCallingFinalize.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCallingFinalize.html deleted file mode 100644 index 4d3e5e1199c..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCallingFinalize.html +++ /dev/null @@ -1 +0,0 @@ -Object.finalize() is called by the garbage collector on an object when garbage collection determines that there are no more references to the object. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCatchingGenericException.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCatchingGenericException.html deleted file mode 100644 index bcc94d8e2cf..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCatchingGenericException.html +++ /dev/null @@ -1 +0,0 @@ -Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block. diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCatchingNPE.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCatchingNPE.html deleted file mode 100644 index a1163c55beb..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCatchingNPE.html +++ /dev/null @@ -1 +0,0 @@ -Code should never throw NPE under normal circumstances. A catch block may hide the original error, causing other more subtle errors in its wake. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCatchingThrowable.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCatchingThrowable.html deleted file mode 100644 index 213ae891976..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidCatchingThrowable.html +++ /dev/null @@ -1 +0,0 @@ -This is dangerous because it casts too wide a net; it can catch things like OutOfMemoryError. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidConstantsInterface.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidConstantsInterface.html deleted file mode 100644 index 3d3eb6506c4..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidConstantsInterface.html +++ /dev/null @@ -1 +0,0 @@ -An interface should be used only to model a behaviour of a class: using an interface as a container of constants is a poor usage pattern. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDecimalLiteralsInBigDecimalConstructor.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDecimalLiteralsInBigDecimalConstructor.html deleted file mode 100644 index d21557d81eb..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDecimalLiteralsInBigDecimalConstructor.html +++ /dev/null @@ -1 +0,0 @@ -One might assume that new BigDecimal(.1) is exactly equal to .1, but it is actually equal to .1000000000000000055511151231257827021181583404541015625. This is so because .1 cannot be represented exactly as a double (or, for that matter, as a binary fraction of any finite length). Thus, the long value that is being passed in to the constructor is not exactly equal to .1, appearances notwithstanding. The (String) constructor, on the other hand, is perfectly predictable: 'new BigDecimal(.1)' is exactly equal to .1, as one would expect. Therefore, it is generally recommended that the (String) constructor be used in preference to this one. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDeeplyNestedIfStmts.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDeeplyNestedIfStmts.html deleted file mode 100644 index 490e1a5213f..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDeeplyNestedIfStmts.html +++ /dev/null @@ -1 +0,0 @@ -Deeply nested if..then statements are hard to read. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDollarSigns.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDollarSigns.html deleted file mode 100644 index a9b667c9d73..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDollarSigns.html +++ /dev/null @@ -1 +0,0 @@ -Avoid using dollar signs in variable/method/class/interface names. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDuplicateLiterals.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDuplicateLiterals.html deleted file mode 100644 index 19e78bffa70..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidDuplicateLiterals.html +++ /dev/null @@ -1,12 +0,0 @@ -Code containing duplicate String literals can usually be improved by declaring the String as a constant field. Example : -
-public class Foo {
- private void bar() {
-    buz("Howdy");
-    buz("Howdy");
-    buz("Howdy");
-    buz("Howdy");
- }
- private void buz(String x) {}
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidEnumAsIdentifier.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidEnumAsIdentifier.html deleted file mode 100644 index e38f2ed03ee..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidEnumAsIdentifier.html +++ /dev/null @@ -1 +0,0 @@ -Finds all places 'enum' is used as an identifier is used. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidFieldNameMatchingMethodName.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidFieldNameMatchingMethodName.html deleted file mode 100644 index f5b16c84db9..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidFieldNameMatchingMethodName.html +++ /dev/null @@ -1,9 +0,0 @@ -It is somewhat confusing to have a field name with the same name as a method. While this is totally legal, having information (field) and actions (method) is not clear naming. Example : -
-public class Foo {
-  Object bar;
-  // bar is data or an action or both?
-  void bar() {
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidFieldNameMatchingTypeName.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidFieldNameMatchingTypeName.html deleted file mode 100644 index 8c36d3703e7..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidFieldNameMatchingTypeName.html +++ /dev/null @@ -1,7 +0,0 @@ -It is somewhat confusing to have a field name matching the declaring class name. This probably means that type and or field names could be more precise. Example : -
-public class Foo extends Bar {
-  // There's probably a better name for foo
-  int foo;
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidFinalLocalVariable.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidFinalLocalVariable.html deleted file mode 100644 index 496b05f2f0c..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidFinalLocalVariable.html +++ /dev/null @@ -1,8 +0,0 @@ -Avoid using final local variables, turn them into fields. Example : -
-public class MyClass {
-    public void foo() {
-        final String finalLocalVariable;
-    }
-}
-  
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidInstanceofChecksInCatchClause.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidInstanceofChecksInCatchClause.html deleted file mode 100644 index dcbf1b72c30..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidInstanceofChecksInCatchClause.html +++ /dev/null @@ -1 +0,0 @@ -Each caught exception type should be handled in its own catch clause. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidInstantiatingObjectsInLoops.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidInstantiatingObjectsInLoops.html deleted file mode 100644 index ccec7620cbe..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidInstantiatingObjectsInLoops.html +++ /dev/null @@ -1 +0,0 @@ -Detects when a new object is created inside a loop \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidLiteralsInIfCondition.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidLiteralsInIfCondition.html deleted file mode 100644 index a1c9e6264a9..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidLiteralsInIfCondition.html +++ /dev/null @@ -1 +0,0 @@ -Avoid using hard coded literals in conditional statements, declare those as static variables or private members. diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidLosingExceptionInformation.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidLosingExceptionInformation.html deleted file mode 100644 index 51d1960f373..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidLosingExceptionInformation.html +++ /dev/null @@ -1 +0,0 @@ -Statements in a catch block that invoke accessors on the exception without using the information only add to code size. Either remove the invocation, or use the return result. diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidMultipleUnaryOperators.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidMultipleUnaryOperators.html deleted file mode 100644 index 906a8e46103..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidMultipleUnaryOperators.html +++ /dev/null @@ -1,20 +0,0 @@ -Using multiple unary operators may be a bug, and/or is confusing. Check the usage is not a bug, or consider simplifying the expression. Example : -
-// These are typo bugs, or at best needlessly complex and confusing:
-int i = - -1;
-int j = + - +1;
-int z = ~~2;
-boolean b = !!true;
-boolean c = !!!true;
-
-// These are better:
-int i = 1;
-int j = -1;
-int z = 2;
-boolean b = true;
-boolean c = false;
-
-// And these just make your brain hurt:
-int i = ~-2;
-int j = -~7;
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidPrintStackTrace.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidPrintStackTrace.html deleted file mode 100644 index 4331778d7f2..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidPrintStackTrace.html +++ /dev/null @@ -1 +0,0 @@ -Avoid printStackTrace(); use a logger call instead. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidProtectedFieldInFinalClass.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidProtectedFieldInFinalClass.html deleted file mode 100644 index 22780fa0965..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidProtectedFieldInFinalClass.html +++ /dev/null @@ -1 +0,0 @@ -Do not use protected fields in final classes since they cannot be subclassed. Clarify your intent by using private or package access modifiers instead. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidReassigningParameters.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidReassigningParameters.html deleted file mode 100644 index 5a57fe5ce54..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidReassigningParameters.html +++ /dev/null @@ -1 +0,0 @@ -Reassigning values to parameters is a questionable practice. Use a temporary local variable instead. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidRethrowingException.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidRethrowingException.html deleted file mode 100644 index 9b3b165b1a3..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidRethrowingException.html +++ /dev/null @@ -1 +0,0 @@ -Catch blocks that merely rethrow a caught exception only add to code size and runtime complexity. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidStringBufferField.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidStringBufferField.html deleted file mode 100644 index c7b57e39964..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidStringBufferField.html +++ /dev/null @@ -1,6 +0,0 @@ -StringBuffers can grow quite a lot, and so may become a source of memory leak (if the owning class has a long life time). Example : -
-class Foo {
-	private StringBuffer memoryLeak;
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidSynchronizedAtMethodLevel.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidSynchronizedAtMethodLevel.html deleted file mode 100644 index b3abad945d7..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidSynchronizedAtMethodLevel.html +++ /dev/null @@ -1 +0,0 @@ -Method level synchronization can backfire when new code is added to the method. Block-level synchronization helps to ensure that only the code that needs synchronization gets it. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThreadGroup.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThreadGroup.html deleted file mode 100644 index aca01a867f8..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThreadGroup.html +++ /dev/null @@ -1 +0,0 @@ -Avoid using ThreadGroup; although it is intended to be used in a threaded environment it contains methods that are not thread safe. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThrowingNewInstanceOfSameException.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThrowingNewInstanceOfSameException.html deleted file mode 100644 index 68f574fa04c..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThrowingNewInstanceOfSameException.html +++ /dev/null @@ -1,13 +0,0 @@ -Catch blocks that merely rethrow a caught exception wrapped inside a new instance of the same type only add to code size and runtime complexity. Example : -
-public class Foo {
-  void bar() {
-    try {
-      // do something
-    }  catch (SomeException se) {
-      // harmless comment
-      throw new SomeException(se);
-    }
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThrowingNullPointerException.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThrowingNullPointerException.html deleted file mode 100644 index d182c08ffcf..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThrowingNullPointerException.html +++ /dev/null @@ -1 +0,0 @@ -Avoid throwing a NullPointerException - it's confusing because most people will assume that the virtual machine threw it. Consider using an IllegalArgumentException instead; this will be clearly seen as a programmer-initiated exception. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThrowingRawExceptionTypes.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThrowingRawExceptionTypes.html deleted file mode 100644 index e79a882cafb..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidThrowingRawExceptionTypes.html +++ /dev/null @@ -1 +0,0 @@ -Avoid throwing certain exception types. Rather than throw a raw RuntimeException, Throwable, Exception, or Error, use a subclassed exception or error instead. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingHardCodedIP.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingHardCodedIP.html deleted file mode 100644 index 0b4c301abf5..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingHardCodedIP.html +++ /dev/null @@ -1 +0,0 @@ -An application with hard coded IP may become impossible to deploy in some case. It never hurts to externalize IP adresses. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingNativeCode.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingNativeCode.html deleted file mode 100644 index 8d8dcab0c6a..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingNativeCode.html +++ /dev/null @@ -1 +0,0 @@ -As JVM and Java language offer already many help in creating application, it should be very rare to have to rely on non-java code. Even though, it is rare to actually have to use Java Native Interface (JNI). As the use of JNI make application less portable, and harder to maintain, it is not recommended. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingOctalValues.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingOctalValues.html deleted file mode 100644 index 71af7425f8f..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingOctalValues.html +++ /dev/null @@ -1 +0,0 @@ -Integer literals should not start with zero. Zero means that the rest of literal will be interpreted as an octal value. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingShortType.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingShortType.html deleted file mode 100644 index 8cc8ea860f0..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingShortType.html +++ /dev/null @@ -1 +0,0 @@ -Java uses the short type to reduce memory usage, not to optimize calculation. On the contrary, the jvm does not has an arithmetic capabilities with the type short. So, the P-code must convert the short into int, then do the proper caculation and then again, convert int to short. So, use of the "short" type may have a great effect on memory usage. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingVolatile.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingVolatile.html deleted file mode 100644 index 89d7ada4fa3..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/AvoidUsingVolatile.html +++ /dev/null @@ -1 +0,0 @@ -Use of the keyword "volatile" is general used to fine tune a Java application, and therefore, requires a good expertise of the Java Memory Model. Morover, its range of action is somewhat misknown. Therefore, the volatile keyword should not be used for maintenance purpose and portability. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BadComparison.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BadComparison.html deleted file mode 100644 index 68c8219f2de..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BadComparison.html +++ /dev/null @@ -1 +0,0 @@ -Avoid equality comparisons with Double.NaN - these are likely to be logic errors. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BeanMembersShouldSerialize.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BeanMembersShouldSerialize.html deleted file mode 100644 index 6f3aa18475b..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BeanMembersShouldSerialize.html +++ /dev/null @@ -1 +0,0 @@ -If a class is a bean, or is referenced by a bean directly or indirectly it needs to be serializable. Member variables need to be marked as transient, static, or have accessor methods in the class. Marking variables as transient is the safest and easiest modification. Accessor methods should follow the Java naming conventions, i.e.if you have a variable foo, you should provide getFoo and setFoo methods. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BigIntegerInstantiation.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BigIntegerInstantiation.html deleted file mode 100644 index 24720d2894a..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BigIntegerInstantiation.html +++ /dev/null @@ -1 +0,0 @@ -Don't create instances of already existing BigInteger (BigInteger.ZERO, BigInteger.ONE) and for 1.5 on, BigInteger.TEN and BigDecimal (BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN) \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BooleanGetMethodName.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BooleanGetMethodName.html deleted file mode 100644 index 1a12ce3b4d0..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BooleanGetMethodName.html +++ /dev/null @@ -1 +0,0 @@ -Looks for methods named "getX()" with "boolean" as the return type. The convention is to name these methods "isX()". \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BooleanInstantiation.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BooleanInstantiation.html deleted file mode 100644 index 87e94991ed4..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BooleanInstantiation.html +++ /dev/null @@ -1 +0,0 @@ -Avoid instantiating Boolean objects; you can reference Boolean.TRUE, Boolean.FALSE, or call Boolean.valueOf() instead. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BooleanInversion.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BooleanInversion.html deleted file mode 100644 index d801c41aae0..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BooleanInversion.html +++ /dev/null @@ -1 +0,0 @@ -Use bitwise inversion to invert boolean values - it's the fastest way to do this. See http://www.javaspecialists.co.za/archive/newsletter.do?issue=042&locale=en_US for specific details \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BrokenNullCheck.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BrokenNullCheck.html deleted file mode 100644 index 21514146ab1..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/BrokenNullCheck.html +++ /dev/null @@ -1 +0,0 @@ -The null check is broken since it will throw a Nullpointer itself. The reason is that a method is called on the object when it is null. It is likely that you used || instead of && or vice versa. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ByteInstantiation.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ByteInstantiation.html deleted file mode 100644 index ee5e1913942..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ByteInstantiation.html +++ /dev/null @@ -1,7 +0,0 @@ -In JDK 1.5, calling new Byte() causes memory allocation. Byte.valueOf() is more memory friendly. Example : -
-public class Foo {
-private Byte i = new Byte(0); // change to Byte i =
-Byte.valueOf(0);
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CallSuperFirst.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CallSuperFirst.html deleted file mode 100644 index 05a64668875..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CallSuperFirst.html +++ /dev/null @@ -1,9 +0,0 @@ -Super should be called at the start of the method. Example : -
-public class DummyActivity extends Activity {
-  public void onCreate(Bundle bundle) {
-    // missing call to super.onCreate(bundle)
-    foo();
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CallSuperInConstructor.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CallSuperInConstructor.html deleted file mode 100644 index ac3480c8f5a..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CallSuperInConstructor.html +++ /dev/null @@ -1 +0,0 @@ -It is a good practice to call super() in a constructor. If super() is not called but another constructor (such as an overloaded constructor) is called, this rule will not report it. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CallSuperLast.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CallSuperLast.html deleted file mode 100644 index 3f658ec175c..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CallSuperLast.html +++ /dev/null @@ -1,9 +0,0 @@ -Super should be called at the end of the method. Example : -
-public class DummyActivity extends Activity {
-  public void onPause() {
-    foo();
-    // missing call to super.onPause()
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CheckResultSet.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CheckResultSet.html deleted file mode 100644 index d05d1c9f4bc..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CheckResultSet.html +++ /dev/null @@ -1 +0,0 @@ -Always check the return of one of the navigation method (next,previous,first,last) of a ResultSet. Indeed, if the value return is "false", the developer should deal with it ! \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ClassCastExceptionWithToArray.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ClassCastExceptionWithToArray.html deleted file mode 100644 index cd3095777c8..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ClassCastExceptionWithToArray.html +++ /dev/null @@ -1 +0,0 @@ -if you need to get an array of a class from your Collection, you should pass an array of the desidered class as the parameter of the toArray method. Otherwise you will get a ClassCastException. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ClassNamingConventions.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ClassNamingConventions.html deleted file mode 100644 index 2979b07e668..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ClassNamingConventions.html +++ /dev/null @@ -1 +0,0 @@ -Class names should always begin with an upper case character. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ClassWithOnlyPrivateConstructorsShouldBeFinal.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ClassWithOnlyPrivateConstructorsShouldBeFinal.html deleted file mode 100644 index b8eb9bc97d4..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ClassWithOnlyPrivateConstructorsShouldBeFinal.html +++ /dev/null @@ -1,6 +0,0 @@ -A class with only private constructors should be final, unless the private constructor is called by a inner class. Example : -
-public class Foo {  //Should be final
-    private Foo() { }
-}
-  
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CloneMethodMustImplementCloneable.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CloneMethodMustImplementCloneable.html deleted file mode 100644 index c531925148e..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CloneMethodMustImplementCloneable.html +++ /dev/null @@ -1 +0,0 @@ -The method clone() should only be implemented if the class implements the Cloneable interface with the exception of a final method that only throws CloneNotSupportedException. This version uses PMD's type resolution facilities, and can detect if the class implements or extends a Cloneable class \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CloneThrowsCloneNotSupportedException.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CloneThrowsCloneNotSupportedException.html deleted file mode 100644 index c64489c5730..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CloneThrowsCloneNotSupportedException.html +++ /dev/null @@ -1 +0,0 @@ -The method clone() should throw a CloneNotSupportedException. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CloseResource.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CloseResource.html deleted file mode 100644 index 2c38ee6fe84..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CloseResource.html +++ /dev/null @@ -1,9 +0,0 @@ -Ensure that resources (like Connection, Statement, and ResultSet objects) are always closed after use. It does this by looking for code patterned like : -
-Connection c = openConnection();
-try {
-  // do stuff, and maybe catch something
-} finally {
-  c.close();
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CollapsibleIfStatements.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CollapsibleIfStatements.html deleted file mode 100644 index 45949a1350d..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CollapsibleIfStatements.html +++ /dev/null @@ -1 +0,0 @@ -Sometimes two 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CompareObjectsWithEquals.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CompareObjectsWithEquals.html deleted file mode 100644 index f9a9250260e..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CompareObjectsWithEquals.html +++ /dev/null @@ -1 +0,0 @@ -Use equals() to compare object references; avoid comparing them with ==. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ConfusingTernary.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ConfusingTernary.html deleted file mode 100644 index 8127996980b..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ConfusingTernary.html +++ /dev/null @@ -1 +0,0 @@ -In an if expression with an else clause, avoid negation in the test. For example, rephrase: if (x != y) diff(); else same(); as: if (x == y) same(); else diff(); Most if (x != y) cases without an else are often return cases, so consistent use of this rule makes the code easier to read. Also, this resolves trivial ordering problems, such as does the error case go first? or does the common case go first?. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ConsecutiveLiteralAppends.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ConsecutiveLiteralAppends.html deleted file mode 100644 index 177373c697a..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ConsecutiveLiteralAppends.html +++ /dev/null @@ -1 +0,0 @@ -Consecutively calling StringBuffer.append with String literals \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ConstructorCallsOverridableMethod.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ConstructorCallsOverridableMethod.html deleted file mode 100644 index 1a463f1ff9b..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ConstructorCallsOverridableMethod.html +++ /dev/null @@ -1,27 +0,0 @@ -Calling overridable methods during construction poses a risk of invoking methods on an incompletely constructed object - and can be difficult to discern. It may leave the sub-class unable to construct its superclass or forced to replicate - the construction process completely within itself, losing the ability to call super(). - If the default constructor contains a call to an overridable method, the subclass may be completely uninstantiable. - Note that this includes method calls throughout the control flow graph - i.e., if a constructor Foo() calls - a private method bar() that calls a public method buz(), this denotes a problem. -
Example : -
-public class SeniorClass {
-  public SeniorClass(){
-      toString(); //may throw NullPointerException if overridden
-  }
-  public String toString(){
-    return "IAmSeniorClass";
-  }
-}
-public class JuniorClass extends SeniorClass {
-  private String name;
-  public JuniorClass(){
-    super(); //Automatic call leads to NullPointerException
-    name = "JuniorClass";
-  }
-  public String toString(){
-    return name.toUpperCase();
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CouplingBetweenObjects.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CouplingBetweenObjects.html deleted file mode 100644 index d05905f268e..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CouplingBetweenObjects.html +++ /dev/null @@ -1 +0,0 @@ -This rule counts unique attributes, local variables and return types within an object. A number higher than specified threshold can indicate a high degree of coupling. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CyclomaticComplexity.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CyclomaticComplexity.html deleted file mode 100644 index 823c68d77de..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/CyclomaticComplexity.html +++ /dev/null @@ -1 +0,0 @@ -Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DataflowAnomalyAnalysis.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DataflowAnomalyAnalysis.html deleted file mode 100644 index 91c74cc0bb3..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DataflowAnomalyAnalysis.html +++ /dev/null @@ -1 +0,0 @@ -The dataflow analysis tracks local definitions, undefinitions and references to variables on different paths on the data flow. From those informations there can be found various problems. 1. UR - Anomaly: There is a reference to a variable that was not defined before. This is a bug and leads to an error. 2. DU - Anomaly: A recently defined variable is undefined. These anomalies may appear in normal source text. 3. DD - Anomaly: A recently defined variable is redefined. This is ominous but don't have to be a bug. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DefaultLabelNotLastInSwitchStmt.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DefaultLabelNotLastInSwitchStmt.html deleted file mode 100644 index 56e093a6dd1..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DefaultLabelNotLastInSwitchStmt.html +++ /dev/null @@ -1,15 +0,0 @@ -Switch statements should have a default label. Example : -
-public class Foo {
- void bar(int a) {
-  switch (a) {
-   case 1:  // do something
-      break;
-   default:  // the default case should be last, by convention
-      break;
-   case 2:
-      break;
-  }
- }
-}
-  
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DefaultPackage.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DefaultPackage.html deleted file mode 100644 index 2dbe6e40a04..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DefaultPackage.html +++ /dev/null @@ -1 +0,0 @@ -Use explicit scoping instead of the default package private level. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotCallGarbageCollectionExplicitly.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotCallGarbageCollectionExplicitly.html deleted file mode 100644 index ca126dff564..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotCallGarbageCollectionExplicitly.html +++ /dev/null @@ -1,20 +0,0 @@ -Calls to System.gc(), Runtime.getRuntime().gc(), and System.runFinalization() are not advised. Code should have the same behavior whether the garbage collection is disabled using the option -Xdisableexplicitgc or not. Moreover, "modern" jvms do a very good job handling garbage collections. If memory usage issues unrelated to memory leaks develop within an application, it should be dealt with JVM options rather than within the code itself. Example : -
- public class GCCall
-{
-  public GCCall()
-  {
-  // Explicit gc call !
-    System.gc();
-  }
-	public void doSomething()
-	{
-		// Explicit gc call !
-		Runtime.getRuntime().gc();
-	}
-
-  public explicitGCcall() { // Explicit gc call ! System.gc(); }
-
-  public void doSomething() { // Explicit gc call ! Runtime.getRuntime().gc(); }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotCallSystemExit.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotCallSystemExit.html deleted file mode 100644 index 7c93d41d014..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotCallSystemExit.html +++ /dev/null @@ -1 +0,0 @@ -Web applications should not call System.exit(), since only the web container or the application server should stop the JVM. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotExtendJavaLangError.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotExtendJavaLangError.html deleted file mode 100644 index e52a647c8dd..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotExtendJavaLangError.html +++ /dev/null @@ -1 +0,0 @@ -Errors are system exceptions. Do not extend them. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotHardCodeSDCard.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotHardCodeSDCard.html deleted file mode 100644 index 003eaefe63b..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotHardCodeSDCard.html +++ /dev/null @@ -1 +0,0 @@ -Use Environment.getExternalStorageDirectory() instead of "/sdcard". diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotThrowExceptionInFinally.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotThrowExceptionInFinally.html deleted file mode 100644 index f98daf6d54a..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotThrowExceptionInFinally.html +++ /dev/null @@ -1,20 +0,0 @@ -Throwing exception in a finally block is confusing. It may mask exception or a defect of the code, it also render code cleanup uninstable. Example : -
-public class Foo
-{
-  public void bar()
-	{
-	  try {
-		// Here do some stuff
-		}
-		catch( Exception e) {
-		// Handling the issue
-		}
-		finally
-		{
-		  // is this really a good idea ?
-			throw new Exception();
-	  }
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotUseThreads.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotUseThreads.html deleted file mode 100644 index 9226e4f3016..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoNotUseThreads.html +++ /dev/null @@ -1 +0,0 @@ -The J2EE specification explicitly forbid use of threads. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontCallThreadRun.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontCallThreadRun.html deleted file mode 100644 index 89305204909..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontCallThreadRun.html +++ /dev/null @@ -1 +0,0 @@ -Explicitly calling Thread.run() method will execute in the caller's thread of control. Instead, call Thread.start() for the intended behavior. diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontImportJavaLang.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontImportJavaLang.html deleted file mode 100644 index 432c002f679..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontImportJavaLang.html +++ /dev/null @@ -1 +0,0 @@ -Avoid importing anything from the package 'java.lang'. These classes are automatically imported (JLS 7.5.3). \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontImportSun.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontImportSun.html deleted file mode 100644 index 7804a920f3b..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontImportSun.html +++ /dev/null @@ -1 +0,0 @@ -Avoid importing anything from the 'sun.*' packages. These packages are not portable and are likely to change. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontNestJsfInJstlIteration.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontNestJsfInJstlIteration.html deleted file mode 100644 index 19fa61f0ef2..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DontNestJsfInJstlIteration.html +++ /dev/null @@ -1 +0,0 @@ -Do not nest JSF component custom actions inside a custom action that iterates over its body. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoubleCheckedLocking.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoubleCheckedLocking.html deleted file mode 100644 index cccba5e2c3d..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DoubleCheckedLocking.html +++ /dev/null @@ -1,16 +0,0 @@ -Partially created objects can be returned by the Double Checked Locking pattern when used in Java. An optimizing JRE may assign a reference to the baz variable before it creates the object the reference is intended to point to. More details. Example : -
-public class Foo {
-  Object baz;
-  Object bar() {
-    if(baz == null) { //baz may be non-null yet not fully created
-      synchronized(this){
-        if(baz == null){
-          baz = new Object();
-        }
-      }
-    }
-    return baz;
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DuplicateImports.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DuplicateImports.html deleted file mode 100644 index a2a0a26a63c..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/DuplicateImports.html +++ /dev/null @@ -1 +0,0 @@ -Avoid duplicate import statements. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyCatchBlock.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyCatchBlock.html deleted file mode 100644 index a1abd8dcd75..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyCatchBlock.html +++ /dev/null @@ -1 +0,0 @@ -Empty Catch Block finds instances where an exception is caught, but nothing is done. In most circumstances, this swallows an exception which should either be acted on or reported. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyFinalizer.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyFinalizer.html deleted file mode 100644 index adf5c09414d..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyFinalizer.html +++ /dev/null @@ -1 +0,0 @@ -If the finalize() method is empty, then it does not need to exist. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyFinallyBlock.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyFinallyBlock.html deleted file mode 100644 index 2fb96e71c50..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyFinallyBlock.html +++ /dev/null @@ -1 +0,0 @@ -Avoid empty finally blocks - these can be deleted. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyIfStmt.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyIfStmt.html deleted file mode 100644 index 90c7cab8350..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyIfStmt.html +++ /dev/null @@ -1 +0,0 @@ -Empty If Statement finds instances where a condition is checked but nothing is done about it. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyInitializer.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyInitializer.html deleted file mode 100644 index e64cd699a61..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyInitializer.html +++ /dev/null @@ -1,10 +0,0 @@ -An empty initializer was found. Example : -
-public class Foo {
-
-   static {} // Why ?
-
-   {} // Again, why ?
-
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyMethodInAbstractClassShouldBeAbstract.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyMethodInAbstractClassShouldBeAbstract.html deleted file mode 100644 index 48d355c4984..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyMethodInAbstractClassShouldBeAbstract.html +++ /dev/null @@ -1,15 +0,0 @@ -An empty method in an abstract class should be abstract instead, as developer may rely on this empty implementation rather than code the appropriate one. -
-public abstract class ShouldBeAbstract
-{
-  public Object couldBeAbstract()
-	{
-	// Should be abstract method ?
-	  return null;
-	}
-
-	public void couldBeAbstract()
-	{
-	}
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyStatementNotInLoop.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyStatementNotInLoop.html deleted file mode 100644 index d37e2d4f609..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyStatementNotInLoop.html +++ /dev/null @@ -1 +0,0 @@ -An empty statement (aka a semicolon by itself) that is not used as the sole body of a for loop or while loop is probably a bug. It could also be a double semicolon, which is useless and should be removed. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyStaticInitializer.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyStaticInitializer.html deleted file mode 100644 index c6d21f09580..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyStaticInitializer.html +++ /dev/null @@ -1 +0,0 @@ -An empty static initializer was found. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptySwitchStatements.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptySwitchStatements.html deleted file mode 100644 index be23de11d7d..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptySwitchStatements.html +++ /dev/null @@ -1 +0,0 @@ -Avoid empty switch statements. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptySynchronizedBlock.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptySynchronizedBlock.html deleted file mode 100644 index 29ec3925641..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptySynchronizedBlock.html +++ /dev/null @@ -1 +0,0 @@ -Avoid empty synchronized blocks - they're useless. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyTryBlock.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyTryBlock.html deleted file mode 100644 index b651a6325a4..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyTryBlock.html +++ /dev/null @@ -1 +0,0 @@ -Avoid empty try blocks - what's the point? \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyWhileStmt.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyWhileStmt.html deleted file mode 100644 index 7623ff20de4..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EmptyWhileStmt.html +++ /dev/null @@ -1 +0,0 @@ -Empty While Statement finds all instances where a while statement does nothing. If it is a timing loop, then you should use Thread.sleep() for it; if it's a while loop that does a lot in the exit expression, rewrite it to make it clearer. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EqualsNull.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EqualsNull.html deleted file mode 100644 index 49fe6e71300..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/EqualsNull.html +++ /dev/null @@ -1 +0,0 @@ -Inexperienced programmers sometimes confuse comparison concepts and use equals() to compare to null. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExceptionAsFlowControl.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExceptionAsFlowControl.html deleted file mode 100644 index 94676492b1d..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExceptionAsFlowControl.html +++ /dev/null @@ -1 +0,0 @@ -Using Exceptions as flow control leads to GOTOish code and obscures true exceptions when debugging. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveClassLength.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveClassLength.html deleted file mode 100644 index ddbe233bd7d..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveClassLength.html +++ /dev/null @@ -1 +0,0 @@ -Long Class files are indications that the class may be trying to do too much. Try to break it down, and reduce the size to something manageable. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveImports.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveImports.html deleted file mode 100644 index 6719df2bd6c..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveImports.html +++ /dev/null @@ -1 +0,0 @@ -A high number of imports can indicate a high degree of coupling within an object. Rule counts the number of unique imports and reports a violation if the count is above the user defined threshold. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveMethodLength.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveMethodLength.html deleted file mode 100644 index 5d2d419a219..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveMethodLength.html +++ /dev/null @@ -1 +0,0 @@ -Violations of this rule usually indicate that the method is doing too much. Try to reduce the method size by creating helper methods and removing any copy/pasted code. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveParameterList.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveParameterList.html deleted file mode 100644 index 2efb6d79374..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessiveParameterList.html +++ /dev/null @@ -1 +0,0 @@ -Long parameter lists can indicate that a new object should be created to wrap the numerous parameters. Basically, try to group the parameters together. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessivePublicCount.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessivePublicCount.html deleted file mode 100644 index 4a65b5747ba..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ExcessivePublicCount.html +++ /dev/null @@ -1 +0,0 @@ -A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalFieldCouldBeStatic.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalFieldCouldBeStatic.html deleted file mode 100644 index fa70c6ed9cc..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalFieldCouldBeStatic.html +++ /dev/null @@ -1 +0,0 @@ -If a final field is assigned to a compile-time constant, it could be made static, thus saving overhead in each object at runtime. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeDoesNotCallSuperFinalize.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeDoesNotCallSuperFinalize.html deleted file mode 100644 index fa071bcbcf4..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeDoesNotCallSuperFinalize.html +++ /dev/null @@ -1 +0,0 @@ -If the finalize() is implemented, its last action should be to call super.finalize. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeOnlyCallsSuperFinalize.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeOnlyCallsSuperFinalize.html deleted file mode 100644 index 934b1f849ac..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeOnlyCallsSuperFinalize.html +++ /dev/null @@ -1 +0,0 @@ -If the finalize() is implemented, it should do something besides just calling super.finalize(). \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeOverloaded.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeOverloaded.html deleted file mode 100644 index e9d3c5da4ec..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeOverloaded.html +++ /dev/null @@ -1 +0,0 @@ -Methods named finalize() should not have parameters. It is confusing and probably a bug to overload finalize(). It will not be called by the VM. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeShouldBeProtected.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeShouldBeProtected.html deleted file mode 100644 index e5db54e0dd3..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/FinalizeShouldBeProtected.html +++ /dev/null @@ -1 +0,0 @@ -If you override finalize(), make it protected. If you make it public, other classes may call it. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ForLoopShouldBeWhileLoop.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ForLoopShouldBeWhileLoop.html deleted file mode 100644 index 5fe63dde81e..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ForLoopShouldBeWhileLoop.html +++ /dev/null @@ -1 +0,0 @@ -Some for loops can be simplified to while loops - this makes them more concise. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ForLoopsMustUseBraces.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ForLoopsMustUseBraces.html deleted file mode 100644 index 2d6acf80d9f..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ForLoopsMustUseBraces.html +++ /dev/null @@ -1 +0,0 @@ -Avoid using 'for' statements without using curly braces, like for (int i=0; i<42;i++) foo(); \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/GenericsNaming.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/GenericsNaming.html deleted file mode 100644 index 879e0178180..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/GenericsNaming.html +++ /dev/null @@ -1 +0,0 @@ -Generics names should be a one letter long and upper case. diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/GuardDebugLogging.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/GuardDebugLogging.html deleted file mode 100644 index cc533ca8688..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/GuardDebugLogging.html +++ /dev/null @@ -1 +0,0 @@ -When log messages are composed by concatenating strings, the whole section should be guarded by a isDebugEnabled() check to avoid performance and memory issues. diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IdempotentOperations.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IdempotentOperations.html deleted file mode 100644 index af59c81d4b5..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IdempotentOperations.html +++ /dev/null @@ -1 +0,0 @@ -Avoid idempotent operations - they are have no effect. Example :
int x = 2;
x = x;
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IfElseStmtsMustUseBraces.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IfElseStmtsMustUseBraces.html deleted file mode 100644 index 0b56c14a351..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IfElseStmtsMustUseBraces.html +++ /dev/null @@ -1 +0,0 @@ -Avoid using if..else statements without using curly braces. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IfStmtsMustUseBraces.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IfStmtsMustUseBraces.html deleted file mode 100644 index 4fcbcce6989..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IfStmtsMustUseBraces.html +++ /dev/null @@ -1 +0,0 @@ -Avoid using if statements without using curly braces. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ImmutableField.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ImmutableField.html deleted file mode 100644 index 1707ed89e3b..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ImmutableField.html +++ /dev/null @@ -1 +0,0 @@ -Identifies private fields whose values never change once they are initialized either in the declaration of the field or by a constructor. This aids in converting existing classes to immutable classes. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ImportFromSamePackage.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ImportFromSamePackage.html deleted file mode 100644 index ac68b340e43..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ImportFromSamePackage.html +++ /dev/null @@ -1 +0,0 @@ -No need to import a type that lives in the same package. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InefficientEmptyStringCheck.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InefficientEmptyStringCheck.html deleted file mode 100644 index f2dadeaf447..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InefficientEmptyStringCheck.html +++ /dev/null @@ -1 +0,0 @@ -String.trim().length() is an inefficient way to check if a String is really empty, as it creates a new String object just to check its size. Consider creating a static function that loops through a string, checking Character.isWhitespace() on each character and returning false if a non-whitespace character is found. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InefficientStringBuffering.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InefficientStringBuffering.html deleted file mode 100644 index e569e278a98..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InefficientStringBuffering.html +++ /dev/null @@ -1 +0,0 @@ -Avoid concatenating non literals in a StringBuffer constructor or append(). \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InstantiationToGetClass.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InstantiationToGetClass.html deleted file mode 100644 index d23a250f3e9..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InstantiationToGetClass.html +++ /dev/null @@ -1 +0,0 @@ -Avoid instantiating an object just to call getClass() on it; use the .class public member instead. Example : replace Class c = new String().getClass(); with Class c = String.class; \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InsufficientStringBufferDeclaration.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InsufficientStringBufferDeclaration.html deleted file mode 100644 index 492eb2cf75d..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/InsufficientStringBufferDeclaration.html +++ /dev/null @@ -1 +0,0 @@ -Failing to pre-size a StringBuffer properly could cause it to re-size many times during runtime. This rule checks the characters that are actually passed into StringBuffer.append(), but represents a best guess worst case scenario. An empty StringBuffer constructor initializes the object to 16 characters. This default is assumed if the length of the constructor can not be determined. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IntegerInstantiation.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IntegerInstantiation.html deleted file mode 100644 index f7e33a6529d..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/IntegerInstantiation.html +++ /dev/null @@ -1 +0,0 @@ -In JDK 1.5, calling new Integer() causes memory allocation. Integer.valueOf() is more memory friendly. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/JumbledIncrementer.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/JumbledIncrementer.html deleted file mode 100644 index 6c544db8d34..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/JumbledIncrementer.html +++ /dev/null @@ -1,12 +0,0 @@ -Avoid jumbled loop incrementers - it's usually a mistake, and it's confusing even if it's what's intended. -
Example : -
-public class JumbledIncrementerRule1 {
-  public void foo() {
-   for (int i = 0; i < 10; i++) {
-    for (int k = 0; k < 20; i++) {
-     System.out.println("Hello");
-    }
-   }
-  }
-}
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LocalHomeNamingConvention.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LocalHomeNamingConvention.html deleted file mode 100644 index 474e74da7dc..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LocalHomeNamingConvention.html +++ /dev/null @@ -1 +0,0 @@ -The Local Home interface of a Session EJB should be suffixed by "LocalHome". \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LocalInterfaceSessionNamingConvention.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LocalInterfaceSessionNamingConvention.html deleted file mode 100644 index f4a50ce4391..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LocalInterfaceSessionNamingConvention.html +++ /dev/null @@ -1 +0,0 @@ -The Local Interface of a Session EJB should be suffixed by "Local". \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LocalVariableCouldBeFinal.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LocalVariableCouldBeFinal.html deleted file mode 100644 index 502d73b5927..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LocalVariableCouldBeFinal.html +++ /dev/null @@ -1,9 +0,0 @@ -A local variable assigned only once can be declared final. Example : -
-public class Bar {
- public void foo () {
-  String a = "a"; //if a will not be assigned again it is better to do this:
-  final String b = "b";
- }
-}
-  
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LoggerIsNotStaticFinal.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LoggerIsNotStaticFinal.html deleted file mode 100644 index d94b4ef0707..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LoggerIsNotStaticFinal.html +++ /dev/null @@ -1 +0,0 @@ -In most cases, the Logger can be declared static and final. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LongInstantiation.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LongInstantiation.html deleted file mode 100644 index 416889e83db..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LongInstantiation.html +++ /dev/null @@ -1,7 +0,0 @@ -In JDK 1.5, calling new Long() causes memory allocation. Long.valueOf() is more memory friendly. Example : -
-public class Foo {
-private Long i = new Long(0); // change to Long i =
-Long.valueOf(0);
-}
-  
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LongVariable.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LongVariable.html deleted file mode 100644 index 664ea5bff23..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LongVariable.html +++ /dev/null @@ -1 +0,0 @@ -Detects when a field, formal or local variable is declared with a long name. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LooseCoupling.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LooseCoupling.html deleted file mode 100644 index 13cfdb8f486..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/LooseCoupling.html +++ /dev/null @@ -1 +0,0 @@ -Avoid using implementation types (i.e., HashSet); use the interface (i.e, Set) instead \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MDBAndSessionBeanNamingConvention.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MDBAndSessionBeanNamingConvention.html deleted file mode 100644 index 5fdb45f4ee1..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MDBAndSessionBeanNamingConvention.html +++ /dev/null @@ -1 +0,0 @@ -The EJB Specification state that any MessageDrivenBean or SessionBean should be suffixed by Bean. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodArgumentCouldBeFinal.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodArgumentCouldBeFinal.html deleted file mode 100644 index 61a58625c9a..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodArgumentCouldBeFinal.html +++ /dev/null @@ -1 +0,0 @@ -A method argument that is never assigned can be declared final. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodNamingConventions.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodNamingConventions.html deleted file mode 100644 index a9fb587cc49..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodNamingConventions.html +++ /dev/null @@ -1,7 +0,0 @@ -Method names should always begin with a lower case character, and should not contain underscores. Example : -
-public class Foo {
-  public void fooStuff() {
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodReturnsInternalArray.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodReturnsInternalArray.html deleted file mode 100644 index 412eb0611d7..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodReturnsInternalArray.html +++ /dev/null @@ -1 +0,0 @@ -Exposing internal arrays directly allows the user to modify some code that could be critical. It is safer to return a copy of the array. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodWithSameNameAsEnclosingClass.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodWithSameNameAsEnclosingClass.html deleted file mode 100644 index 36727163301..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MethodWithSameNameAsEnclosingClass.html +++ /dev/null @@ -1,9 +0,0 @@ -Non-constructor methods should not have the same name as the enclosing class. Example : -
-public class MyClass {
-  // this is bad because it is a method
-  public void MyClass() {}
-  // this is OK because it is a constructor
-  public MyClass() {}
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MisleadingVariableName.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MisleadingVariableName.html deleted file mode 100644 index 6f09d20dfff..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MisleadingVariableName.html +++ /dev/null @@ -1,9 +0,0 @@ -Detects when a non-field has a name starting with 'm_'. This usually indicates a field and thus is confusing. Example : -
-public class Foo {
-  private int m_foo; // OK
-  public void bar(String m_baz) {  // Bad
-    int m_boz = 42; // Bad
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MisplacedNullCheck.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MisplacedNullCheck.html deleted file mode 100644 index 4d95221ae2d..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MisplacedNullCheck.html +++ /dev/null @@ -1,8 +0,0 @@ -The null check here is misplaced. if the variable is null you'll get a NullPointerException. - Either the check is useless (the variable will never be null) or it's incorrect. -
Example : -
-if (object1!=null && object2.equals(object1)) { 
-  ...
-}      
-      
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MissingBreakInSwitch.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MissingBreakInSwitch.html deleted file mode 100644 index 6524ba6bab5..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MissingBreakInSwitch.html +++ /dev/null @@ -1 +0,0 @@ -A switch statement without an enclosed break statement may be a bug. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MissingSerialVersionUID.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MissingSerialVersionUID.html deleted file mode 100644 index a2bb931fb3d..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MissingSerialVersionUID.html +++ /dev/null @@ -1 +0,0 @@ -Classes that are serializable should provide a serialVersionUID field. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MissingStaticMethodInNonInstantiatableClass.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MissingStaticMethodInNonInstantiatableClass.html deleted file mode 100644 index d977bbfc8ae..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MissingStaticMethodInNonInstantiatableClass.html +++ /dev/null @@ -1 +0,0 @@ -A class that has private constructors and does not have any static methods or fields cannot be used. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MoreThanOneLogger.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MoreThanOneLogger.html deleted file mode 100644 index e07b109bc94..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/MoreThanOneLogger.html +++ /dev/null @@ -1 +0,0 @@ -Normally only one logger is used in each class. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NPathComplexity.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NPathComplexity.html deleted file mode 100644 index c78feb0bebe..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NPathComplexity.html +++ /dev/null @@ -1,8 +0,0 @@ -The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity. Example : -
-public class Foo {
-  void bar() {
-   // lots of complicated code
-  }
- }
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NcssConstructorCount.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NcssConstructorCount.html deleted file mode 100644 index ee78d54e690..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NcssConstructorCount.html +++ /dev/null @@ -1 +0,0 @@ -This rule uses the NCSS (Non Commenting Source Statements) algorithm to determine the number of lines of code for a given constructor. NCSS ignores comments, and counts actual statements. Using this algorithm, lines of code that are split are counted as one. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NcssMethodCount.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NcssMethodCount.html deleted file mode 100644 index 028f149c3c2..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NcssMethodCount.html +++ /dev/null @@ -1 +0,0 @@ -This rule uses the NCSS (Non Commenting Source Statements) algorithm to determine the number of lines of code for a given method. NCSS ignores comments, and counts actual statements. Using this algorithm, lines of code that are split are counted as one. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NcssTypeCount.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NcssTypeCount.html deleted file mode 100644 index f64694a92a7..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NcssTypeCount.html +++ /dev/null @@ -1 +0,0 @@ -This rule uses the NCSS (Non Commenting Source Statements) algorithm to determine the number of lines of code for a given type. NCSS ignores comments, and counts actual statements. Using this algorithm, lines of code that are split are counted as one. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NoPackage.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NoPackage.html deleted file mode 100644 index 2d9bfc042e7..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NoPackage.html +++ /dev/null @@ -1,6 +0,0 @@ -Detects when a class or interface does not have a package definition. Example : -
-// no package declaration
-public class ClassInDefaultPackage {
-}
-  
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NonCaseLabelInSwitchStatement.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NonCaseLabelInSwitchStatement.html deleted file mode 100644 index ae9629c8f64..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NonCaseLabelInSwitchStatement.html +++ /dev/null @@ -1 +0,0 @@ -A non-case label (e.g. a named break/continue label) was present in a switch statement. This legal, but confusing. It is easy to mix up the case labels and the non-case labels. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NonStaticInitializer.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NonStaticInitializer.html deleted file mode 100644 index 94d30d98ee8..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NonStaticInitializer.html +++ /dev/null @@ -1 +0,0 @@ -A nonstatic initializer block will be called any time a constructor is invoked (just prior to invoking the constructor). While this is a valid language construct, it is rarely used and is confusing. Example :
public class MyClass {
// this block gets run before any call to a constructor {
System.out.println("I am about to construct myself");
}
}
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NonThreadSafeSingleton.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NonThreadSafeSingleton.html deleted file mode 100644 index 230bdd0cea9..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NonThreadSafeSingleton.html +++ /dev/null @@ -1 +0,0 @@ -Non-thread safe singletons can result in bad state changes. Eliminate static singletons if possible by instantiating the object directly. Static singletons are usually not needed as only a single instance exists anyway. Other possible fixes are to synchronize the entire method or to use an initialize-on-demand holder class (do not use the double-check idiom). See Effective Java, item 48. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NullAssignment.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NullAssignment.html deleted file mode 100644 index 108d09b6345..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/NullAssignment.html +++ /dev/null @@ -1 +0,0 @@ -Assigning a null to a variable (outside of its declaration) is usually bad form. Some times, the assignment is an indication that the programmer doesn't completely understand what is going on in the code. NOTE: This sort of assignment may in rare cases be useful to encourage garbage collection. If that's what you're using it for, by all means, disregard this rule :-) \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/OnlyOneReturn.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/OnlyOneReturn.html deleted file mode 100644 index 4f9c447a22a..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/OnlyOneReturn.html +++ /dev/null @@ -1 +0,0 @@ -A method should have only one exit point, and that should be the last statement in the method. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/OptimizableToArrayCall.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/OptimizableToArrayCall.html deleted file mode 100644 index 5de4c3f7b98..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/OptimizableToArrayCall.html +++ /dev/null @@ -1 +0,0 @@ -A call to Collection.toArray can use the Collection's size vs an empty Array of the desired type. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/OverrideBothEqualsAndHashcode.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/OverrideBothEqualsAndHashcode.html deleted file mode 100644 index 843e0f9a142..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/OverrideBothEqualsAndHashcode.html +++ /dev/null @@ -1,26 +0,0 @@ -Override both public boolean Object.equals(Object other), and public int Object.hashCode(), or override neither. Even if you are inheriting a hashCode() from a parent class, consider implementing hashCode and explicitly delegating to your superclass. Example : -
-// this is bad
-public class Bar {
-  public boolean equals(Object o) {
-      // do some comparison
-  }
-}
-
-// and so is this
-public class Baz {
-  public int hashCode() {
-      // return some hash value
-  }
-}
-
-// this is OK
-public class Foo {
-  public boolean equals(Object other) {
-      // do some comparison
-  }
-  public int hashCode() {
-      // return some hash value
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/PackageCase.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/PackageCase.html deleted file mode 100644 index a5f62b2a6ec..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/PackageCase.html +++ /dev/null @@ -1,6 +0,0 @@ -Detects when a package definition contains upper case characters. Example : -
-package com.MyCompany;  // <- should be lower case name
-public class SomeClass {
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/PositionLiteralsFirstInComparisons.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/PositionLiteralsFirstInComparisons.html deleted file mode 100644 index 7d1f1d3a8ca..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/PositionLiteralsFirstInComparisons.html +++ /dev/null @@ -1 +0,0 @@ -Position literals first in String comparisons - that way if the String is null you won't get a NullPointerException, it'll just return false. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/PreserveStackTrace.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/PreserveStackTrace.html deleted file mode 100644 index d09e6ceff6e..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/PreserveStackTrace.html +++ /dev/null @@ -1 +0,0 @@ -Throwing a new exception from a catch block without passing the original exception into the new Exception will cause the true stack trace to be lost, and can make it difficult to debug effectively. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProperCloneImplementation.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProperCloneImplementation.html deleted file mode 100644 index 5cb3686ba18..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProperCloneImplementation.html +++ /dev/null @@ -1,8 +0,0 @@ -Object clone() should be implemented with super.clone(). Example : -
-class Foo{
-    public Object clone(){
-        return new Foo(); // This is bad
-    }
-}
-  
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProperLogger.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProperLogger.html deleted file mode 100644 index db54d066cb0..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProperLogger.html +++ /dev/null @@ -1 +0,0 @@ -Logger should normally be defined private static final and have the correct class. Private final Log log; is also allowed for rare cases when loggers need to be passed around, but the logger needs to be passed into the constructor. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProtectLogD.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProtectLogD.html deleted file mode 100644 index 5c53794c53d..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProtectLogD.html +++ /dev/null @@ -1,12 +0,0 @@ -Log.d calls should be protected by checking Config.LOGD first. Example : -
-public class DummyActivity extends Activity {
-  public void foo() {
-    Log.d("TAG", "msg1"); // Bad
-
-    bar();
-
-    if (Config.LOGD) Log.d("TAG", "msg1"); // Good
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProtectLogV.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProtectLogV.html deleted file mode 100644 index 972de298011..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ProtectLogV.html +++ /dev/null @@ -1,10 +0,0 @@ -Log.v calls should be protected by checking Config.LOGV first. Example : -
-public class DummyActivity extends Activity {
-  public void foo() {
-    Log.v("TAG", "msg1"); // Bad
-    bar();
-    if (Config.LOGV) Log.v("TAG", "msg1"); // Good
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/RemoteInterfaceNamingConvention.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/RemoteInterfaceNamingConvention.html deleted file mode 100644 index 38613ff1ecf..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/RemoteInterfaceNamingConvention.html +++ /dev/null @@ -1 +0,0 @@ -Remote Interface of a Session EJB should NOT be suffixed. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/RemoteSessionInterfaceNamingConvention.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/RemoteSessionInterfaceNamingConvention.html deleted file mode 100644 index 4217aaea163..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/RemoteSessionInterfaceNamingConvention.html +++ /dev/null @@ -1 +0,0 @@ -Remote Home interface of a Session EJB should be suffixed by "Home". \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReplaceEnumerationWithIterator.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReplaceEnumerationWithIterator.html deleted file mode 100644 index eba0aeef695..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReplaceEnumerationWithIterator.html +++ /dev/null @@ -1 +0,0 @@ -Consider replacing this Enumeration with the newer java.util.Iterator \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReplaceHashtableWithMap.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReplaceHashtableWithMap.html deleted file mode 100644 index 4e10dae3939..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReplaceHashtableWithMap.html +++ /dev/null @@ -1 +0,0 @@ -Consider replacing this Hashtable with the newer java.util.Map \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReplaceVectorWithList.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReplaceVectorWithList.html deleted file mode 100644 index 1a9f8f11be1..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReplaceVectorWithList.html +++ /dev/null @@ -1 +0,0 @@ -Consider replacing Vector usages with the newer java.util.ArrayList if expensive threadsafe operation is not required. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReturnEmptyArrayRatherThanNull.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReturnEmptyArrayRatherThanNull.html deleted file mode 100644 index 0958488b4e6..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReturnEmptyArrayRatherThanNull.html +++ /dev/null @@ -1,19 +0,0 @@ -For any method that returns an array, it's a better behavior to return an empty array rather than a null reference. Example : -
-public class Example
-{
-  // Not a good idea...
-  public int []badBehavior()
-  {
-    // ...
-    return null;
-  }
-
-  // Good behavior
-  public String[] bonnePratique()
-  {
-    //...
-    return new String[0];
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReturnFromFinallyBlock.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReturnFromFinallyBlock.html deleted file mode 100644 index 87f055248b4..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ReturnFromFinallyBlock.html +++ /dev/null @@ -1 +0,0 @@ -Avoid returning from a finally block - this can discard exceptions. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ShortInstantiation.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ShortInstantiation.html deleted file mode 100644 index 74dd9cc2efe..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ShortInstantiation.html +++ /dev/null @@ -1,7 +0,0 @@ -In JDK 1.5, calling new Short() causes memory allocation. Short.valueOf() is more memory friendly. Example : -
-public class Foo {
-private Short i = new Short(0); // change to Short i =
-Short.valueOf(0);
-}
-  
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ShortMethodName.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ShortMethodName.html deleted file mode 100644 index 7cf2c15d8f7..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ShortMethodName.html +++ /dev/null @@ -1,7 +0,0 @@ -Detects when very short method names are used. Example : -
-public class ShortMethod {
-  public void a( int i ) { // Violation
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ShortVariable.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ShortVariable.html deleted file mode 100644 index fee4d9634b5..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/ShortVariable.html +++ /dev/null @@ -1 +0,0 @@ -Detects when a field, local, or parameter has a very short name. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SignatureDeclareThrowsException.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SignatureDeclareThrowsException.html deleted file mode 100644 index 4c0e8f6b438..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SignatureDeclareThrowsException.html +++ /dev/null @@ -1 +0,0 @@ -It is unclear which exceptions that can be thrown from the methods. It might be difficult to document and understand the vague interfaces. Use either a class derived from RuntimeException or a checked exception. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimpleDateFormatNeedsLocale.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimpleDateFormatNeedsLocale.html deleted file mode 100644 index 2aa900c0557..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimpleDateFormatNeedsLocale.html +++ /dev/null @@ -1 +0,0 @@ -Be sure to specify a Locale when creating a new instance of SimpleDateFormat. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyBooleanExpressions.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyBooleanExpressions.html deleted file mode 100644 index 9ce7f5e6765..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyBooleanExpressions.html +++ /dev/null @@ -1,10 +0,0 @@ -Avoid unnecessary comparisons in boolean expressions - this complicates simple code. Example : -
-public class Bar {
- // can be simplified to
- // bar = isFoo();
- private boolean bar = (isFoo() == true);
-
- public isFoo() { return false;}
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyBooleanReturns.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyBooleanReturns.html deleted file mode 100644 index 47f40a87a10..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyBooleanReturns.html +++ /dev/null @@ -1,16 +0,0 @@ -Avoid unnecessary if..then..else statements when returning a boolean. Example : -
-public class Foo {
-  private int bar =2;
-  public boolean isBarEqualsTo(int x) {
-    // this bit of code
-    if (bar == x) {
-     return true;
-    } else {
-     return false;
-    }
-    // can be replaced with a simple
-    // return bar == x;
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyConditional.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyConditional.html deleted file mode 100644 index 0a0560c1a7e..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyConditional.html +++ /dev/null @@ -1 +0,0 @@ -No need to check for null before an instanceof; the instanceof keyword returns false when given a null argument. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyStartsWith.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyStartsWith.html deleted file mode 100644 index 58f39dc6117..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SimplifyStartsWith.html +++ /dev/null @@ -1 +0,0 @@ -Since it passes in a literal of length 1, this call to String.startsWith can be rewritten using String.charAt(0) to save some time. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SingularField.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SingularField.html deleted file mode 100644 index b51c8207a89..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SingularField.html +++ /dev/null @@ -1 +0,0 @@ -A field that's only used by one method could perhaps be replaced by a local variable. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StaticEJBFieldShouldBeFinal.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StaticEJBFieldShouldBeFinal.html deleted file mode 100644 index e895746214b..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StaticEJBFieldShouldBeFinal.html +++ /dev/null @@ -1 +0,0 @@ -According to the J2EE specification (p.494), an EJB should not have any static fields with write access. However, static read only fields are allowed. This ensures proper behavior especially when instances are distributed by the container on several JREs. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StringBufferInstantiationWithChar.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StringBufferInstantiationWithChar.html deleted file mode 100644 index f19972be573..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StringBufferInstantiationWithChar.html +++ /dev/null @@ -1 +0,0 @@ -StringBuffer sb = new StringBuffer('c'); The char will be converted into int to intialize StringBuffer size. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StringInstantiation.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StringInstantiation.html deleted file mode 100644 index b1af5a94b08..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StringInstantiation.html +++ /dev/null @@ -1 +0,0 @@ -Avoid instantiating String objects; this is usually unnecessary. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StringToString.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StringToString.html deleted file mode 100644 index 4ffdce4b6b8..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/StringToString.html +++ /dev/null @@ -1 +0,0 @@ -Avoid calling toString() on String objects; this is unnecessary. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousConstantFieldName.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousConstantFieldName.html deleted file mode 100644 index a2eb3ea3bf7..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousConstantFieldName.html +++ /dev/null @@ -1,9 +0,0 @@ -A field name is all in uppercase characters, which in Sun's Java naming conventions indicate a constant. However, the field is not final. Example : -
-public class Foo {
-  // this is bad, since someone could accidentally
-  // do PI = 2.71828; which is actualy e
-  // final double PI = 3.16; is ok
-  double PI = 3.16;
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousEqualsMethodName.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousEqualsMethodName.html deleted file mode 100644 index 7930a310c1b..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousEqualsMethodName.html +++ /dev/null @@ -1,11 +0,0 @@ -The method name and parameter number are suspiciously close to equals(Object), which may mean you are intending to override the equals(Object) method. Example : -
-public class Foo {
-  public int equals(Object o) {
-  // oops, this probably was supposed to be boolean equals
-  }
-  public boolean equals(String s) {
-  // oops, this probably was supposed to be equals(Object)
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousHashcodeMethodName.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousHashcodeMethodName.html deleted file mode 100644 index 32c34be1f4a..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousHashcodeMethodName.html +++ /dev/null @@ -1,7 +0,0 @@ -The method name and return type are suspiciously close to hashCode(), which may mean you are intending to override the hashCode() method. Example : -
-public class Foo {
-  public int hashcode() {
-  // oops, this probably was supposed to be hashCode
-  }
-}
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousOctalEscape.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousOctalEscape.html deleted file mode 100644 index 450afb135f0..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SuspiciousOctalEscape.html +++ /dev/null @@ -1 +0,0 @@ -A suspicious octal escape sequence was found inside a String literal. The Java language specification (section 3.10.6) says an octal escape sequence inside a literal String shall consist of a backslash followed by: OctalDigit | OctalDigit OctalDigit | ZeroToThree OctalDigit OctalDigit Any octal escape sequence followed by non-octal digits can be confusing, e.g. "\038" is interpreted as the octal escape sequence "\03" followed by the literal character 8. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SwitchDensity.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SwitchDensity.html deleted file mode 100644 index 9e89ec78f17..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SwitchDensity.html +++ /dev/null @@ -1 +0,0 @@ -A high ratio of statements to labels in a switch statement implies that the switch statement is doing too much work. Consider moving the statements into new methods, or creating subclasses based on the switch variable. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SwitchStmtsShouldHaveDefault.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SwitchStmtsShouldHaveDefault.html deleted file mode 100644 index 27a356d42ea..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SwitchStmtsShouldHaveDefault.html +++ /dev/null @@ -1,11 +0,0 @@ -Switch statements should have a default label. Example : -
-public class Foo {
- public void bar() {
-  int x = 2;
-  switch (x) {
-   case 2: int j = 8;
-  }
- }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SystemPrintln.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SystemPrintln.html deleted file mode 100644 index a543cc0fbb4..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/SystemPrintln.html +++ /dev/null @@ -1 +0,0 @@ -System.(out|err).print is used, consider using a logger. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooFewBranchesForASwitchStatement.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooFewBranchesForASwitchStatement.html deleted file mode 100644 index d82ec43cdd0..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooFewBranchesForASwitchStatement.html +++ /dev/null @@ -1,16 +0,0 @@ -Swith are designed complex branches, and allow branches to share treatement. Using a switch for only a few branches is ill advised, as switches are not as easy to understand as if. In this case, it's most likely is a good idea to use a if statement instead, at least to increase code readability. Example : -
-// With a minimumNumberCaseForASwitch of 3
-public class Foo {
-  public void bar() {
-    switch (condition) {
-      case ONE:
-        instruction;
-        break;
-      default:
-        break; // not enough for a 'switch' stmt,
-               // a simple 'if' stmt would have been more appropriate
-    }
-  }
-}
-
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooManyFields.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooManyFields.html deleted file mode 100644 index 6bd695cb88c..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooManyFields.html +++ /dev/null @@ -1 +0,0 @@ -Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooManyMethods.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooManyMethods.html deleted file mode 100644 index e071382abc7..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooManyMethods.html +++ /dev/null @@ -1 +0,0 @@ -A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooManyStaticImports.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooManyStaticImports.html deleted file mode 100644 index 97fd173f9de..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/TooManyStaticImports.html +++ /dev/null @@ -1 +0,0 @@ -If you overuse the static import feature, it can make your program unreadable and unmaintainable, polluting its namespace with all the static members you import. Readers of your code (including you, a few months after you wrote it) will not know which class a static member comes from (Sun 1.5 Language Guide). \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UncommentedEmptyConstructor.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UncommentedEmptyConstructor.html deleted file mode 100644 index 972c596b05e..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UncommentedEmptyConstructor.html +++ /dev/null @@ -1 +0,0 @@ -Uncommented Empty Constructor finds instances where a constructor does not contain statements, but there is no comment. By explicitly commenting empty constructors it is easier to distinguish between intentional (commented) and unintentional empty constructors. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UncommentedEmptyMethod.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UncommentedEmptyMethod.html deleted file mode 100644 index 6417293359d..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UncommentedEmptyMethod.html +++ /dev/null @@ -1 +0,0 @@ -Uncommented Empty Method finds instances where a method does not contain statements, but there is no comment. By explicitly commenting empty methods it is easier to distinguish between intentional (commented) and unintentional empty methods. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnconditionalIfStatement.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnconditionalIfStatement.html deleted file mode 100644 index f239f1a66b9..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnconditionalIfStatement.html +++ /dev/null @@ -1 +0,0 @@ -Do not use if statements that are always true or always false. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryCaseChange.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryCaseChange.html deleted file mode 100644 index 2bee9f6d335..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryCaseChange.html +++ /dev/null @@ -1 +0,0 @@ -Using equalsIgnoreCase() is faster than using toUpperCase/toLowerCase().equals() \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryConstructor.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryConstructor.html deleted file mode 100644 index 827a81cf523..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryConstructor.html +++ /dev/null @@ -1 +0,0 @@ -This rule detects when a constructor is not necessary; i.e., when there's only one constructor, it's public, has an empty body, and takes no arguments. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryConversionTemporary.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryConversionTemporary.html deleted file mode 100644 index 3129868c0d4..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryConversionTemporary.html +++ /dev/null @@ -1 +0,0 @@ -Avoid unnecessary temporaries when converting primitives to Strings \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryFinalModifier.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryFinalModifier.html deleted file mode 100644 index 386699d11b4..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryFinalModifier.html +++ /dev/null @@ -1 +0,0 @@ -When a class has the final modifier, all the methods are automatically final. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryLocalBeforeReturn.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryLocalBeforeReturn.html deleted file mode 100644 index b978db59874..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryLocalBeforeReturn.html +++ /dev/null @@ -1 +0,0 @@ -Avoid unnecessarily creating local variables \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryParentheses.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryParentheses.html deleted file mode 100644 index 39389b0c0b8..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryParentheses.html +++ /dev/null @@ -1,8 +0,0 @@ -Sometimes expressions are wrapped in unnecessary parentheses, making them look like a function call. Example : -
-public class Foo {
-  boolean bar() {
-    return (true);
-  }
-}
-  
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryReturn.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryReturn.html deleted file mode 100644 index 4c8c0cdbf33..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryReturn.html +++ /dev/null @@ -1 +0,0 @@ -Avoid unnecessary return statements \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryWrapperObjectCreation.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryWrapperObjectCreation.html deleted file mode 100644 index 3a7afbaf6ea..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnnecessaryWrapperObjectCreation.html +++ /dev/null @@ -1 +0,0 @@ -Parsing method should be called directy instead. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnsynchronizedStaticDateFormatter.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnsynchronizedStaticDateFormatter.html deleted file mode 100644 index d828f58079e..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnsynchronizedStaticDateFormatter.html +++ /dev/null @@ -1 +0,0 @@ -SimpleDateFormat is not synchronized. Sun recomends separate format instances for each thread. If multiple threads must access a static formatter, the formatter must be synchronized either on method or block level. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedFormalParameter.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedFormalParameter.html deleted file mode 100644 index 3da842acbd3..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedFormalParameter.html +++ /dev/null @@ -1 +0,0 @@ -Avoid passing parameters to methods or constructors and then not using those parameters. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedImports.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedImports.html deleted file mode 100644 index 2e71f38345f..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedImports.html +++ /dev/null @@ -1,6 +0,0 @@ -Avoid unused import statements. Example : -
-// this is bad
-import java.io.File;
-public class Foo {}  
-  
\ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedLocalVariable.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedLocalVariable.html deleted file mode 100644 index cad4ea89de7..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedLocalVariable.html +++ /dev/null @@ -1 +0,0 @@ -Detects when a local variable is declared and/or assigned, but not used. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedModifier.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedModifier.html deleted file mode 100644 index c0483ed0d29..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedModifier.html +++ /dev/null @@ -1 +0,0 @@ -Fields in interfaces are automatically public static final, and methods are public abstract. Classes or interfaces nested in an interface are automatically public and static (all nested interfaces are automatically static). For historical reasons, modifiers which are implied by the context are accepted by the compiler, but are superfluous. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedNullCheckInEquals.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedNullCheckInEquals.html deleted file mode 100644 index d00720da14e..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedNullCheckInEquals.html +++ /dev/null @@ -1 +0,0 @@ -After checking an object reference for null, you should invoke equals() on that object rather than passing it to another object's equals() method. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedPrivateField.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedPrivateField.html deleted file mode 100644 index 6640433af07..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedPrivateField.html +++ /dev/null @@ -1 +0,0 @@ -Detects when a private field is declared and/or assigned a value, but not used. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedPrivateMethod.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedPrivateMethod.html deleted file mode 100644 index 7b4e26a5bc9..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UnusedPrivateMethod.html +++ /dev/null @@ -1 +0,0 @@ -Unused Private Method detects when a private method is declared but is unused. This PMD rule should be switched off and replaced by its equivalent from Squid that is more effective : it generates less false-positives and detects more dead code. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseArrayListInsteadOfVector.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseArrayListInsteadOfVector.html deleted file mode 100644 index d20c380eed6..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseArrayListInsteadOfVector.html +++ /dev/null @@ -1 +0,0 @@ -ArrayList is a much better Collection implementation than Vector. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseArraysAsList.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseArraysAsList.html deleted file mode 100644 index 70c2b196612..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseArraysAsList.html +++ /dev/null @@ -1 +0,0 @@ -The class java.util.Arrays has a asList method that should be use when you want to create a new List from an array of objects. It is faster than executing a loop to cpy all the elements of the array one by one \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseCollectionIsEmpty.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseCollectionIsEmpty.html deleted file mode 100644 index 640a4f26181..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseCollectionIsEmpty.html +++ /dev/null @@ -1 +0,0 @@ -The isEmpty() method on java.util.Collection is provided to see if a collection has any elements. Comparing the value of size() to 0 merely duplicates existing behavior. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseConcurrentHashMap.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseConcurrentHashMap.html deleted file mode 100644 index a419810b189..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseConcurrentHashMap.html +++ /dev/null @@ -1 +0,0 @@ -Since Java5 brought a new implementation of the Map interface, specially designed for concurrent application. diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseCorrectExceptionLogging.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseCorrectExceptionLogging.html deleted file mode 100644 index 551c48e1d8b..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseCorrectExceptionLogging.html +++ /dev/null @@ -1 +0,0 @@ -To make sure the full stacktrace is printed out, use the logging statement with 2 arguments: a String and a Throwable. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseEqualsToCompareStrings.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseEqualsToCompareStrings.html deleted file mode 100644 index 0a9b9f658be..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseEqualsToCompareStrings.html +++ /dev/null @@ -1 +0,0 @@ -Using "==" or "!=" to compare strings only works if intern version is used on both sides. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseIndexOfChar.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseIndexOfChar.html deleted file mode 100644 index 10fc6396521..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseIndexOfChar.html +++ /dev/null @@ -1 +0,0 @@ -Use String.indexOf(char) when checking for the index of a single character; it executes faster. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseLocaleWithCaseConversions.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseLocaleWithCaseConversions.html deleted file mode 100644 index d68da56b94c..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseLocaleWithCaseConversions.html +++ /dev/null @@ -1 +0,0 @@ -When doing a String.toLowerCase()/toUpperCase() call, use a Locale. This avoids problems with certain locales, i.e. Turkish. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseNotifyAllInsteadOfNotify.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseNotifyAllInsteadOfNotify.html deleted file mode 100644 index 9ac671f58ab..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseNotifyAllInsteadOfNotify.html +++ /dev/null @@ -1 +0,0 @@ -Thread.notify() awakens a thread monitoring the object. If more than one thread is monitoring, then only one is chosen. The thread chosen is arbitrary; thus it's usually safer to call notifyAll() instead. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseProperClassLoader.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseProperClassLoader.html deleted file mode 100644 index 126cd478301..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseProperClassLoader.html +++ /dev/null @@ -1 +0,0 @@ -In J2EE getClassLoader() might not work as expected. Use Thread.currentThread().getContextClassLoader() instead. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseSingleton.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseSingleton.html deleted file mode 100644 index ff4dfa7e778..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseSingleton.html +++ /dev/null @@ -1 +0,0 @@ -If you have a class that has nothing but static methods, consider making it a Singleton. Note that this doesn't apply to abstract classes, since their subclasses may well include non-static methods. Also, if you want this class to be a Singleton, remember to add a private constructor to prevent instantiation. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseStringBufferForStringAppends.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseStringBufferForStringAppends.html deleted file mode 100644 index 7a2cb57cb99..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseStringBufferForStringAppends.html +++ /dev/null @@ -1 +0,0 @@ -Finds usages of += for appending strings. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseStringBufferLength.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseStringBufferLength.html deleted file mode 100644 index 83aec725327..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UseStringBufferLength.html +++ /dev/null @@ -1 +0,0 @@ -Use StringBuffer.length() to determine StringBuffer length rather than using StringBuffer.toString().equals() or StringBuffer.toString().length() ==. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UselessOperationOnImmutable.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UselessOperationOnImmutable.html deleted file mode 100644 index 961218b332a..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UselessOperationOnImmutable.html +++ /dev/null @@ -1 +0,0 @@ -An operation on an Immutable object (BigDecimal or BigInteger) won't change the object itself. The result of the operation is a new object. Therefore, ignoring the operation result is an error. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UselessOverridingMethod.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UselessOverridingMethod.html deleted file mode 100644 index 4c22baed4b6..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UselessOverridingMethod.html +++ /dev/null @@ -1 +0,0 @@ -The overriding method merely calls the same method defined in a superclass \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UselessStringValueOf.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UselessStringValueOf.html deleted file mode 100644 index 0b22380e074..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/UselessStringValueOf.html +++ /dev/null @@ -1 +0,0 @@ -No need to call String.valueOf to append to a string; just use the valueOf() argument directly. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/VariableNamingConventions.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/VariableNamingConventions.html deleted file mode 100644 index 17ed2343ddc..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/VariableNamingConventions.html +++ /dev/null @@ -1 +0,0 @@ -A variable naming conventions rule - customize this to your liking. Currently, it checks for final variables that should be fully capitalized and non-final variables that should not include underscores. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/WhileLoopsMustUseBraces.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/WhileLoopsMustUseBraces.html deleted file mode 100644 index d4eaf9e04e3..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/WhileLoopsMustUseBraces.html +++ /dev/null @@ -1 +0,0 @@ -Avoid using 'while' statements without using curly braces. \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/XPathRule.html b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/XPathRule.html deleted file mode 100644 index 2199e3c7103..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/l10n/pmd/rules/pmd/XPathRule.html +++ /dev/null @@ -1,20 +0,0 @@ -PMD provides a very handy method for creating new rules by writing an XPath query. When the XPath query finds a match, a violation is created. -Let's take a simple example: assume we have a Factory class that must be always declared final. -We'd like to report a violation each time a declaration of Factory is not declared final. Consider the following class: -
-public class a {
-  Factory f1;
-
-  void myMethod() {
-    Factory f2;
-    int a;
-  }
-}
-
-The following expression does the magic we need: -
-//VariableDeclarator
- [../Type/ReferenceType/ClassOrInterfaceType
-  [@Image = 'Factory'] and ..[@Final='false']]
-
-See the XPath rule tutorial for more information. diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/pmd-plugin.properties b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/pmd-plugin.properties deleted file mode 100644 index c9f11c295c9..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/pmd-plugin.properties +++ /dev/null @@ -1 +0,0 @@ -pmd.version=${pmd.version} diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/profile-sonar-way.xml b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/profile-sonar-way.xml deleted file mode 100644 index 4492c675e54..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/profile-sonar-way.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - Sonar PMD rules generated configuration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/profile-sun-conventions.xml b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/profile-sun-conventions.xml deleted file mode 100644 index 64ebfa7719e..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/profile-sun-conventions.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Generated by Sonar - - - diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/rules-unit-tests.xml b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/rules-unit-tests.xml deleted file mode 100644 index eadf08b31d4..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/rules-unit-tests.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - MAJOR - - - - MAJOR - - - - MINOR - - - - MAJOR - - - - MAJOR - - - - MINOR - - - - MINOR - - - - MINOR - - - - MINOR - - - - MINOR - - - diff --git a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/rules.xml b/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/rules.xml deleted file mode 100644 index a4778d1e9e8..00000000000 --- a/plugins/sonar-pmd-plugin/src/main/resources/org/sonar/plugins/pmd/rules.xml +++ /dev/null @@ -1,1254 +0,0 @@ - - - - MAJOR - rulesets/basic.xml/DontCallThreadRun - - - - MAJOR - rulesets/logging-jakarta-commons.xml/GuardDebugLogging - - - - MAJOR - rulesets/naming.xml/GenericsNaming - - - - MAJOR - rulesets/strictexception.xml/AvoidCatchingGenericException - - - - MAJOR - rulesets/strictexception.xml/AvoidLosingExceptionInformation - - - - MAJOR - rulesets/controversial.xml/AvoidLiteralsInIfCondition - - - - MAJOR - rulesets/controversial.xml/UseConcurrentHashMap - - - - MAJOR - rulesets/android.xml/DoNotHardCodeSDCard - - - - MAJOR - rulesets/strictexception.xml/AvoidThrowingNewInstanceOfSameException - - - - MAJOR - rulesets/android.xml/CallSuperFirst - - - - MAJOR - rulesets/android.xml/CallSuperLast - - - - MAJOR - rulesets/android.xml/ProtectLogD - - - - MAJOR - rulesets/android.xml/ProtectLogV - - - - MAJOR - rulesets/basic.xml/EmptyInitializer - - - - MAJOR - rulesets/codesize.xml/CyclomaticComplexity - - - - - - - - - - MAJOR - rulesets/strings.xml/AvoidStringBufferField - - - - MAJOR - - - - - MAJOR - - - - - - - MINOR - - - - - MINOR - - - - - - - MAJOR - - - - - CRITICAL - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - - - MINOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MINOR - - - - - CRITICAL - - - - - INFO - - - - - MINOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - CRITICAL - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MINOR - - - - - INFO - - - - - MAJOR - - - - - MAJOR - - - - - MINOR - - - - - MAJOR - - - - - MINOR - - - - - MINOR - - - - - MINOR - - - - - MAJOR - - - - - MAJOR - - - - - - - - - MAJOR - - - - - - - MAJOR - - - - - - - MAJOR - - - - - MINOR - - - - - MINOR - - - - - MAJOR - - - - - MINOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - CRITICAL - - - - - CRITICAL - - - - - - - CRITICAL - - - - - CRITICAL - - - - - MAJOR - - - - - CRITICAL - - - - - MAJOR - - - - - MAJOR - - - - - MINOR - - - - - MAJOR - - - - - MAJOR - - - - - CRITICAL - - - - - MINOR - - - - - MAJOR - - - - - CRITICAL - - - - - MAJOR - - - - - MAJOR - - - - - INFO - - - - - MINOR - - - - - MAJOR - - - - - - - MAJOR - - - - - MAJOR - - - - - CRITICAL - - - - - CRITICAL - - - - - MAJOR - - - - - CRITICAL - - - - - CRITICAL - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - - - MAJOR - - - - - MAJOR - - - - - - - MAJOR - - - - - MAJOR - - - - - MINOR - - - - - MAJOR - - - - - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - CRITICAL - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - CRITICAL - - - - - MAJOR - - - - - MINOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - - - - - MAJOR - - - - - MAJOR - - - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MINOR - - - - - CRITICAL - - - - - CRITICAL - - - - - CRITICAL - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - - - - - - - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MINOR - - - - - MINOR - - - - - MINOR - - - - - MINOR - - - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MINOR - - - - - MAJOR - - - - - MAJOR - - - - - - - MAJOR - - - - - - - MAJOR - - - - - - - MAJOR - - - - - - - MAJOR - - - - - - - MAJOR - - - - - - - MAJOR - - - - - - - MAJOR - - - - - - - MINOR - - - - - MINOR - - - - - MINOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - - - MAJOR - - - - - MAJOR - - - - - - - MAJOR - - - - - MAJOR - - - - - - - - - - - - - MAJOR - rulesets/naming.xml/MethodNamingConventions - - - - MAJOR - - - - - MINOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - CRITICAL - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - MAJOR - - - - - - - MAJOR - - MULTIPLE - - - - - - - diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdConfigurationTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdConfigurationTest.java deleted file mode 100644 index 411eaa387d7..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdConfigurationTest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import net.sourceforge.pmd.Report; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.config.Settings; -import org.sonar.api.resources.ProjectFileSystem; -import org.sonar.api.utils.SonarException; - -import java.io.File; -import java.io.IOException; - -import static org.fest.assertions.Assertions.assertThat; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.matches; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -public class PmdConfigurationTest { - PmdConfiguration configuration; - - Settings settings = new Settings(); - ProjectFileSystem fs = mock(ProjectFileSystem.class); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Before - public void setUpPmdConfiguration() { - configuration = new PmdConfiguration(fs, settings); - } - - @Test - public void should_return_default_target_xml_report_when_property_is_not_set() { - File targetXMLReport = configuration.getTargetXMLReport(); - - assertThat(targetXMLReport).isNull(); - } - - @Test - public void should_set_target_xml_report() { - when(fs.resolvePath("pmd-result.xml")).thenReturn(new File("/workingDir/pmd-result.xml")); - - settings.setProperty(PmdConfiguration.PROPERTY_GENERATE_XML, true); - File targetXMLReport = configuration.getTargetXMLReport(); - - assertThat(targetXMLReport).isEqualTo(new File("/workingDir/pmd-result.xml")); - } - - @Test - public void should_dump_xml_rule_set() throws IOException { - when(fs.writeToWorkingDirectory("", "pmd.xml")).thenReturn(new File("/workingDir/pmd.xml")); - - File rulesFile = configuration.dumpXmlRuleSet("pmd", ""); - - assertThat(rulesFile).isEqualTo(new File("/workingDir/pmd.xml")); - } - - @Test - public void should_fail_to_dump_xml_rule_set() throws IOException { - when(fs.writeToWorkingDirectory("", "pmd.xml")).thenThrow(new IOException("BUG")); - - expectedException.expect(SonarException.class); - expectedException.expectMessage("Fail to save the PMD configuration"); - - configuration.dumpXmlRuleSet("pmd", ""); - } - - @Test - public void should_dump_xml_report() throws IOException { - when(fs.writeToWorkingDirectory(matches("(?s).*.*"), eq("pmd-result.xml"))).thenReturn(new File("/workingDir/pmd-result.xml")); - - settings.setProperty(PmdConfiguration.PROPERTY_GENERATE_XML, true); - File reportFile = configuration.dumpXmlReport(new Report()); - - assertThat(reportFile).isEqualTo(new File("/workingDir/pmd-result.xml")); - } - - @Test - public void should_ignore_xml_report_when_property_is_not_set() { - File reportFile = configuration.dumpXmlReport(new Report()); - - assertThat(reportFile).isNull(); - verifyZeroInteractions(fs); - } -} diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdExecutorTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdExecutorTest.java deleted file mode 100644 index 9f0ee2eed7c..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdExecutorTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import com.google.common.base.Charsets; -import net.sourceforge.pmd.Report; -import net.sourceforge.pmd.RuleContext; -import net.sourceforge.pmd.RuleSets; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mockito; -import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.InputFile; -import org.sonar.api.resources.Java; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.ProjectFileSystem; -import org.sonar.test.TestUtils; - -import java.io.File; -import java.util.Arrays; -import java.util.Collections; - -import static org.fest.assertions.Assertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; - -public class PmdExecutorTest { - PmdExecutor pmdExecutor; - - Project project = mock(Project.class); - ProjectFileSystem projectFileSystem = mock(ProjectFileSystem.class); - RulesProfile rulesProfile = mock(RulesProfile.class); - PmdProfileExporter pmdProfileExporter = mock(PmdProfileExporter.class); - PmdConfiguration pmdConfiguration = mock(PmdConfiguration.class); - PmdTemplate pmdTemplate = mock(PmdTemplate.class); - - @Before - public void setUpPmdExecutor() { - pmdExecutor = Mockito.spy(new PmdExecutor(project, projectFileSystem, rulesProfile, pmdProfileExporter, pmdConfiguration)); - - doReturn(pmdTemplate).when(pmdExecutor).createPmdTemplate(); - } - - @Test - public void should_execute_pmd_on_source_files_and_test_files() { - InputFile srcFile = file("src/Class.java"); - InputFile tstFile = file("test/ClassTest.java"); - when(pmdProfileExporter.exportProfile(PmdConstants.REPOSITORY_KEY, rulesProfile)).thenReturn(TestUtils.getResourceContent("/org/sonar/plugins/pmd/simple.xml")); - when(pmdProfileExporter.exportProfile(PmdConstants.TEST_REPOSITORY_KEY, rulesProfile)).thenReturn(TestUtils.getResourceContent("/org/sonar/plugins/pmd/junit.xml")); - when(projectFileSystem.getSourceCharset()).thenReturn(Charsets.UTF_8); - when(projectFileSystem.mainFiles(Java.KEY)).thenReturn(Arrays.asList(srcFile)); - when(projectFileSystem.testFiles(Java.KEY)).thenReturn(Arrays.asList(tstFile)); - - Report report = pmdExecutor.execute(); - - verify(pmdTemplate).process(eq(srcFile), eq(Charsets.UTF_8), any(RuleSets.class), any(RuleContext.class)); - verify(pmdTemplate).process(eq(tstFile), eq(Charsets.UTF_8), any(RuleSets.class), any(RuleContext.class)); - assertThat(report).isNotNull(); - } - - @Test - public void should_dump_configuration_as_xml() { - when(pmdProfileExporter.exportProfile(PmdConstants.REPOSITORY_KEY, rulesProfile)).thenReturn(TestUtils.getResourceContent("/org/sonar/plugins/pmd/simple.xml")); - when(pmdProfileExporter.exportProfile(PmdConstants.TEST_REPOSITORY_KEY, rulesProfile)).thenReturn(TestUtils.getResourceContent("/org/sonar/plugins/pmd/junit.xml")); - - Report report = pmdExecutor.execute(); - - verify(pmdConfiguration).dumpXmlReport(report); - } - - @Test - public void should_dump_ruleset_as_xml() { - InputFile srcFile = file("src/Class.java"); - InputFile tstFile = file("test/ClassTest.java"); - when(pmdProfileExporter.exportProfile(PmdConstants.REPOSITORY_KEY, rulesProfile)).thenReturn(TestUtils.getResourceContent("/org/sonar/plugins/pmd/simple.xml")); - when(pmdProfileExporter.exportProfile(PmdConstants.TEST_REPOSITORY_KEY, rulesProfile)).thenReturn(TestUtils.getResourceContent("/org/sonar/plugins/pmd/junit.xml")); - when(projectFileSystem.mainFiles(Java.KEY)).thenReturn(Arrays.asList(srcFile)); - when(projectFileSystem.testFiles(Java.KEY)).thenReturn(Arrays.asList(tstFile)); - - pmdExecutor.execute(); - - verify(pmdConfiguration).dumpXmlRuleSet(PmdConstants.REPOSITORY_KEY, TestUtils.getResourceContent("/org/sonar/plugins/pmd/simple.xml")); - verify(pmdConfiguration).dumpXmlRuleSet(PmdConstants.TEST_REPOSITORY_KEY, TestUtils.getResourceContent("/org/sonar/plugins/pmd/junit.xml")); - } - - @Test - public void should_ignore_empty_test_dir() { - InputFile srcFile = file("src/Class.java"); - doReturn(pmdTemplate).when(pmdExecutor).createPmdTemplate(); - when(pmdProfileExporter.exportProfile(PmdConstants.REPOSITORY_KEY, rulesProfile)).thenReturn(TestUtils.getResourceContent("/org/sonar/plugins/pmd/simple.xml")); - when(projectFileSystem.getSourceCharset()).thenReturn(Charsets.UTF_8); - when(projectFileSystem.mainFiles(Java.KEY)).thenReturn(Arrays.asList(srcFile)); - when(projectFileSystem.testFiles(Java.KEY)).thenReturn(Collections. emptyList()); - - pmdExecutor.execute(); - - verify(pmdTemplate).process(eq(srcFile), eq(Charsets.UTF_8), any(RuleSets.class), any(RuleContext.class)); - verifyNoMoreInteractions(pmdTemplate); - } - - static InputFile file(String path) { - InputFile inputFile = mock(InputFile.class); - when(inputFile.getFile()).thenReturn(new File(path)); - return inputFile; - } -} diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdLevelUtilsTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdLevelUtilsTest.java deleted file mode 100644 index 2b4fad4fbc2..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdLevelUtilsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import org.junit.Test; -import org.sonar.api.rules.RulePriority; - -import static org.fest.assertions.Assertions.assertThat; - -public class PmdLevelUtilsTest { - @Test - public void should_get_priority_from_level() { - assertThat(PmdLevelUtils.fromLevel("1")).isSameAs(RulePriority.BLOCKER); - assertThat(PmdLevelUtils.fromLevel("2")).isSameAs(RulePriority.CRITICAL); - assertThat(PmdLevelUtils.fromLevel("3")).isSameAs(RulePriority.MAJOR); - assertThat(PmdLevelUtils.fromLevel("4")).isSameAs(RulePriority.MINOR); - assertThat(PmdLevelUtils.fromLevel("5")).isSameAs(RulePriority.INFO); - assertThat(PmdLevelUtils.fromLevel("?")).isNull(); - assertThat(PmdLevelUtils.fromLevel(null)).isNull(); - } - - @Test - public void should_get_level_from_priority() { - assertThat(PmdLevelUtils.toLevel(RulePriority.BLOCKER)).isEqualTo("1"); - assertThat(PmdLevelUtils.toLevel(RulePriority.CRITICAL)).isEqualTo("2"); - assertThat(PmdLevelUtils.toLevel(RulePriority.MAJOR)).isEqualTo("3"); - assertThat(PmdLevelUtils.toLevel(RulePriority.MINOR)).isEqualTo("4"); - assertThat(PmdLevelUtils.toLevel(RulePriority.INFO)).isEqualTo("5"); - } -} diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdPluginTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdPluginTest.java deleted file mode 100644 index 4a0902a4bae..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdPluginTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import org.junit.Test; -import org.sonar.api.Extension; - -import java.util.List; - -import static org.fest.assertions.Assertions.assertThat; - -public class PmdPluginTest { - PmdPlugin plugin = new PmdPlugin(); - - @Test - public void should_contain_both_rule_repositories() { - List> extensions = plugin.getExtensions(); - - assertThat(extensions).contains(PmdRuleRepository.class, PmdUnitTestsRuleRepository.class); - } -} diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileExporterTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileExporterTest.java deleted file mode 100644 index ab0044010af..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileExporterTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import org.junit.Test; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.sonar.api.platform.ServerFileSystem; -import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.rules.ActiveRule; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleFinder; -import org.sonar.api.rules.RuleQuery; -import org.sonar.api.rules.XMLRuleParser; -import org.sonar.api.utils.SonarException; -import org.sonar.api.utils.ValidationMessages; -import org.sonar.plugins.pmd.xml.PmdProperty; -import org.sonar.plugins.pmd.xml.PmdRule; -import org.sonar.test.TestUtils; - -import java.io.StringReader; -import java.util.List; - -import static org.fest.assertions.Assertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static org.sonar.test.MoreConditions.equalsIgnoreEOL; - -public class PmdProfileExporterTest { - PmdProfileExporter exporter = new PmdProfileExporter(); - - @Test - public void should_export_pmd_profile() { - String importedXml = TestUtils.getResourceContent("/org/sonar/plugins/pmd/export_simple.xml"); - - String exportedXml = exporter.exportProfile(PmdConstants.REPOSITORY_KEY, importProfile(importedXml)); - - assertThat(exportedXml).satisfies(equalsIgnoreEOL(importedXml)); - } - - @Test - public void should_export_empty_configuration_as_xml() { - String exportedXml = exporter.exportProfile(PmdConstants.REPOSITORY_KEY, RulesProfile.create()); - - assertThat(exportedXml).satisfies(equalsIgnoreEOL("")); - } - - @Test - public void should_export_xPath_rule() { - Rule rule = Rule.create(PmdConstants.REPOSITORY_KEY, "MyOwnRule", "This is my own xpath rule.") - .setConfigKey(PmdConstants.XPATH_CLASS) - .setRepositoryKey(PmdConstants.REPOSITORY_KEY); - rule.createParameter(PmdConstants.XPATH_EXPRESSION_PARAM); - rule.createParameter(PmdConstants.XPATH_MESSAGE_PARAM); - - RulesProfile profile = RulesProfile.create(); - ActiveRule xpath = profile.activateRule(rule, null); - xpath.setParameter(PmdConstants.XPATH_EXPRESSION_PARAM, "//FieldDeclaration"); - xpath.setParameter(PmdConstants.XPATH_MESSAGE_PARAM, "This is bad"); - - String exportedXml = exporter.exportProfile(PmdConstants.REPOSITORY_KEY, profile); - - assertThat(exportedXml).satisfies(equalsIgnoreEOL(TestUtils.getResourceContent("/org/sonar/plugins/pmd/export_xpath_rules.xml"))); - } - - @Test(expected = SonarException.class) - public void should_fail_if_message_not_provided_for_xPath_rule() { - PmdRule rule = new PmdRule(PmdConstants.XPATH_CLASS); - - rule.addProperty(new PmdProperty(PmdConstants.XPATH_EXPRESSION_PARAM, "xpathExpression")); - rule.setName("MyOwnRule"); - - exporter.processXPathRule("xpathKey", rule); - } - - @Test - public void should_process_xPath_rule() { - PmdRule rule = new PmdRule(PmdConstants.XPATH_CLASS); - rule.setName("MyOwnRule"); - rule.addProperty(new PmdProperty(PmdConstants.XPATH_EXPRESSION_PARAM, "xpathExpression")); - rule.addProperty(new PmdProperty(PmdConstants.XPATH_MESSAGE_PARAM, "message")); - - exporter.processXPathRule("xpathKey", rule); - - assertThat(rule.getMessage()).isEqualTo("message"); - assertThat(rule.getRef()).isNull(); - assertThat(rule.getClazz()).isEqualTo(PmdConstants.XPATH_CLASS); - assertThat(rule.getProperty(PmdConstants.XPATH_MESSAGE_PARAM)).isNull(); - assertThat(rule.getName()).isEqualTo("xpathKey"); - assertThat(rule.getProperty(PmdConstants.XPATH_EXPRESSION_PARAM).getValue()).isEqualTo("xpathExpression"); - } - - @Test(expected = SonarException.class) - public void should_fail_if_xPath_not_provided() { - PmdRule rule = new PmdRule(PmdConstants.XPATH_CLASS); - rule.setName("MyOwnRule"); - rule.addProperty(new PmdProperty(PmdConstants.XPATH_MESSAGE_PARAM, "This is bad")); - - exporter.processXPathRule("xpathKey", rule); - } - - static RulesProfile importProfile(String configuration) { - PmdRuleRepository pmdRuleRepository = new PmdRuleRepository(mock(ServerFileSystem.class), new XMLRuleParser()); - RuleFinder ruleFinder = createRuleFinder(pmdRuleRepository.createRules()); - PmdProfileImporter importer = new PmdProfileImporter(ruleFinder); - - return importer.importProfile(new StringReader(configuration), ValidationMessages.create()); - } - - static RuleFinder createRuleFinder(final List rules) { - RuleFinder ruleFinder = mock(RuleFinder.class); - when(ruleFinder.find(any(RuleQuery.class))).then(new Answer() { - public Rule answer(InvocationOnMock invocation) { - RuleQuery query = (RuleQuery) invocation.getArguments()[0]; - for (Rule rule : rules) { - if (query.getConfigKey().equals(rule.getConfigKey())) { - return rule.setRepositoryKey(PmdConstants.REPOSITORY_KEY); - } - } - return null; - } - }); - return ruleFinder; - } -} diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileImporterTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileImporterTest.java deleted file mode 100644 index 9744390354e..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfileImporterTest.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.rules.ActiveRule; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleFinder; -import org.sonar.api.rules.RulePriority; -import org.sonar.api.rules.RuleQuery; -import org.sonar.api.utils.ValidationMessages; -import org.sonar.plugins.pmd.xml.PmdRuleset; -import org.sonar.test.TestUtils; - -import java.io.Reader; -import java.io.StringReader; - -import static org.fest.assertions.Assertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class PmdProfileImporterTest { - PmdProfileImporter importer; - ValidationMessages messages; - - @Before - public void setUpImporter() { - messages = ValidationMessages.create(); - importer = new PmdProfileImporter(createRuleFinder()); - } - - @Test - public void should_import_pmd_ruleset() { - Reader reader = read("/org/sonar/plugins/pmd/simple.xml"); - - PmdRuleset pmdRuleset = importer.parsePmdRuleset(reader, messages); - - assertThat(pmdRuleset.getPmdRules()).hasSize(3); - } - - @Test - public void should_import_simple_profile() { - Reader reader = read("/org/sonar/plugins/pmd/simple.xml"); - - RulesProfile profile = importer.importProfile(reader, messages); - - assertThat(profile.getActiveRules()).hasSize(3); - assertThat(profile.getActiveRuleByConfigKey("pmd", "rulesets/coupling.xml/ExcessiveImports")).isNotNull(); - assertThat(profile.getActiveRuleByConfigKey("pmd", "rulesets/design.xml/UseNotifyAllInsteadOfNotify")).isNotNull(); - assertThat(messages.hasErrors()).isFalse(); - } - - @Test - public void should_import_profile_with_xpath_rule() { - Reader reader = read("/org/sonar/plugins/pmd/export_xpath_rules.xml"); - - RulesProfile profile = importer.importProfile(reader, messages); - - assertThat(profile.getActiveRules()).isEmpty(); - assertThat(messages.hasWarnings()).isTrue(); - } - - @Test - public void should_import_parameter() { - Reader reader = read("/org/sonar/plugins/pmd/simple.xml"); - - RulesProfile profile = importer.importProfile(reader, messages); - ActiveRule activeRule = profile.getActiveRuleByConfigKey("pmd", "rulesets/coupling.xml/ExcessiveImports"); - - assertThat(activeRule.getParameter("max")).isEqualTo("30"); - } - - @Test - public void should_import_default_priority() { - Reader reader = read("/org/sonar/plugins/pmd/simple.xml"); - - RulesProfile profile = importer.importProfile(reader, messages); - ActiveRule activeRule = profile.getActiveRuleByConfigKey("pmd", "rulesets/coupling.xml/ExcessiveImports"); - - assertThat(activeRule.getSeverity()).isSameAs(RulePriority.BLOCKER); - } - - @Test - public void should_import_priority() { - Reader reader = read("/org/sonar/plugins/pmd/simple.xml"); - - RulesProfile profile = importer.importProfile(reader, messages); - - ActiveRule activeRule = profile.getActiveRuleByConfigKey("pmd", "rulesets/design.xml/UseNotifyAllInsteadOfNotify"); - assertThat(activeRule.getSeverity()).isSameAs(RulePriority.MINOR); - - activeRule = profile.getActiveRuleByConfigKey("pmd", "rulesets/coupling.xml/CouplingBetweenObjects"); - assertThat(activeRule.getSeverity()).isSameAs(RulePriority.CRITICAL); - } - - @Test - public void should_import_pmd_configuration_with_unknown_nodes() { - Reader reader = read("/org/sonar/plugins/pmd/complex-with-unknown-nodes.xml"); - - RulesProfile profile = importer.importProfile(reader, messages); - - assertThat(profile.getActiveRules()).hasSize(3); - } - - @Test - public void should_deal_with_unsupported_property() { - Reader reader = read("/org/sonar/plugins/pmd/simple.xml"); - - RulesProfile profile = importer.importProfile(reader, messages); - ActiveRule check = profile.getActiveRuleByConfigKey("pmd", "rulesets/coupling.xml/CouplingBetweenObjects"); - - assertThat(check.getParameter("threshold")).isNull(); - assertThat(messages.getWarnings()).hasSize(1); - } - - @Test - public void should_fail_on_invalid_xml() { - Reader reader = new StringReader("not xml"); - - importer.importProfile(reader, messages); - - assertThat(messages.getErrors()).hasSize(1); - } - - @Test - public void should_warn_on_unknown_rule() { - Reader reader = read("/org/sonar/plugins/pmd/simple.xml"); - - importer = new PmdProfileImporter(mock(RuleFinder.class)); - RulesProfile profile = importer.importProfile(reader, messages); - - assertThat(profile.getActiveRules()).isEmpty(); - assertThat(messages.getWarnings()).hasSize(3); - } - - static Reader read(String path) { - return new StringReader(TestUtils.getResourceContent(path)); - } - - static RuleFinder createRuleFinder() { - RuleFinder ruleFinder = mock(RuleFinder.class); - when(ruleFinder.find(any(RuleQuery.class))).then(new Answer() { - public Rule answer(InvocationOnMock invocation) { - RuleQuery query = (RuleQuery) invocation.getArguments()[0]; - Rule rule = Rule.create(query.getRepositoryKey(), "", "").setConfigKey(query.getConfigKey()).setSeverity(RulePriority.BLOCKER); - if (rule.getConfigKey().equals("rulesets/coupling.xml/ExcessiveImports")) { - rule.createParameter("max"); - } - return rule; - } - }); - return ruleFinder; - } -} diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfilesTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfilesTest.java deleted file mode 100644 index b1c5f731bc8..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdProfilesTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import org.junit.Test; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.sonar.api.profiles.ProfileDefinition; -import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleFinder; -import org.sonar.api.rules.RuleQuery; -import org.sonar.api.utils.ValidationMessages; - -import static org.fest.assertions.Assertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class PmdProfilesTest { - ValidationMessages validation = ValidationMessages.create(); - - @Test - public void should_create_sun_convention_profile() { - SunConventionsProfile sunConvention = new SunConventionsProfile(new PmdProfileImporter(ruleFinder())); - - RulesProfile profile = sunConvention.createProfile(validation); - - assertThat(profile.getActiveRulesByRepository(PmdConstants.REPOSITORY_KEY)).isNotEmpty(); - assertThat(validation.hasErrors()).isFalse(); - } - - @Test - public void should_create_sonar_way_profile() { - ProfileDefinition sonarWay = new SonarWayProfile(new PmdProfileImporter(ruleFinder())); - - RulesProfile profile = sonarWay.createProfile(validation); - - assertThat(profile.getActiveRulesByRepository(PmdConstants.REPOSITORY_KEY)).isNotEmpty(); - assertThat(validation.hasErrors()).isFalse(); - } - - @Test - public void should_create_sonar_way_with_findbugs_profile() { - ProfileDefinition sonarWayWithFindbugs = new SonarWayWithFindbugsProfile(new SonarWayProfile(new PmdProfileImporter(ruleFinder()))); - - RulesProfile profile = sonarWayWithFindbugs.createProfile(validation); - - assertThat(profile.getActiveRulesByRepository(PmdConstants.REPOSITORY_KEY)).isNotEmpty(); - assertThat(validation.hasErrors()).isFalse(); - } - - static RuleFinder ruleFinder() { - RuleFinder ruleFinder = mock(RuleFinder.class); - when(ruleFinder.find(any(RuleQuery.class))).then(new Answer() { - public Rule answer(InvocationOnMock invocation) { - RuleQuery query = (RuleQuery) invocation.getArguments()[0]; - return Rule.create(query.getRepositoryKey(), "", ""); - } - }); - return ruleFinder; - } -} diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdRuleRepositoryTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdRuleRepositoryTest.java deleted file mode 100644 index 30113aa0764..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdRuleRepositoryTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; -import org.junit.Before; -import org.junit.Test; -import org.sonar.api.PropertyType; -import org.sonar.api.platform.ServerFileSystem; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.XMLRuleParser; -import org.sonar.test.TestUtils; -import org.sonar.test.i18n.RuleRepositoryTestHelper; - -import java.io.File; -import java.util.Arrays; -import java.util.List; - -import static org.fest.assertions.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class PmdRuleRepositoryTest { - PmdRuleRepository repository; - - ServerFileSystem fileSystem = mock(ServerFileSystem.class); - - @Before - public void setUpRuleRepository() { - repository = new PmdRuleRepository(fileSystem, new XMLRuleParser()); - } - - @Test - public void should_have_correct_name_and_key() { - assertThat(repository.getKey()).isEqualTo("pmd"); - assertThat(repository.getLanguage()).isEqualTo("java"); - assertThat(repository.getName()).isEqualTo("PMD"); - } - - @Test - public void should_load_repository_from_xml() { - List rules = repository.createRules(); - - assertThat(rules.size()).isGreaterThan(100); - } - - @Test - public void should_load_extensions() { - File file = TestUtils.getResource("/org/sonar/plugins/pmd/rules-extension.xml"); - when(fileSystem.getExtensions("pmd", "xml")).thenReturn(Arrays.asList(file)); - - List rules = repository.createRules(); - - assertThat(rules).onProperty("key").contains("Extension"); - } - - @Test - public void should_exclude_junit_rules() { - List rules = repository.createRules(); - - assertThat(rules).onProperty("key").excludes("JUnitStaticSuite"); - } - - @Test - public void should_use_text_parameter_for_xpath_rule() { - Rule xpathRule = Iterables.find(repository.createRules(), new Predicate() { - public boolean apply(Rule rule) { - return rule.getKey().equals("XPathRule"); - } - }); - - assertThat(xpathRule.getParam("xpath").getType()).isEqualTo(PropertyType.TEXT.name()); - } - - @Test - public void should_provide_a_name_and_description_for_each_rule() { - List rules = RuleRepositoryTestHelper.createRulesWithNameAndDescription("pmd", repository); - - assertThat(rules).onProperty("name").excludes(null, ""); - assertThat(rules).onProperty("description").excludes(null, ""); - } -} diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdSensorTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdSensorTest.java deleted file mode 100644 index ac617358b2b..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdSensorTest.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import org.junit.rules.ExpectedException; - -import org.junit.Rule; - -import org.sonar.api.utils.XmlParserException; - -import com.google.common.collect.Iterators; -import net.sourceforge.pmd.IRuleViolation; -import net.sourceforge.pmd.Report; -import org.junit.Before; -import org.junit.Test; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.Java; -import org.sonar.api.resources.Project; -import org.sonar.api.rules.Violation; - -import static org.fest.assertions.Assertions.assertThat; -import static org.mockito.Mockito.RETURNS_DEEP_STUBS; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; - -public class PmdSensorTest { - PmdSensor pmdSensor; - - Project project = mock(Project.class, RETURNS_DEEP_STUBS); - RulesProfile profile = mock(RulesProfile.class, RETURNS_DEEP_STUBS); - PmdExecutor executor = mock(PmdExecutor.class); - PmdViolationToRuleViolation pmdViolationToRuleViolation = mock(PmdViolationToRuleViolation.class); - SensorContext sensorContext = mock(SensorContext.class); - Violation violation = mock(Violation.class); - - @Rule - public ExpectedException exception = ExpectedException.none(); - - @Before - public void setUpPmdSensor() { - pmdSensor = new PmdSensor(profile, executor, pmdViolationToRuleViolation); - } - - @Test - public void should_execute_on_project_without_main_files() { - when(project.getFileSystem().mainFiles(Java.KEY).isEmpty()).thenReturn(true); - - boolean shouldExecute = pmdSensor.shouldExecuteOnProject(project); - - assertThat(shouldExecute).isTrue(); - } - - @Test - public void should_execute_on_project_without_test_files() { - when(project.getFileSystem().testFiles(Java.KEY).isEmpty()).thenReturn(true); - - boolean shouldExecute = pmdSensor.shouldExecuteOnProject(project); - - assertThat(shouldExecute).isTrue(); - } - - @Test - public void should_not_execute_on_project_without_any_files() { - when(project.getFileSystem().mainFiles(Java.KEY).isEmpty()).thenReturn(true); - when(project.getFileSystem().testFiles(Java.KEY).isEmpty()).thenReturn(true); - - boolean shouldExecute = pmdSensor.shouldExecuteOnProject(project); - - assertThat(shouldExecute).isFalse(); - } - - @Test - public void should_not_execute_on_project_without_active_rules() { - when(profile.getActiveRulesByRepository(PmdConstants.REPOSITORY_KEY).isEmpty()).thenReturn(true); - when(profile.getActiveRulesByRepository(PmdConstants.TEST_REPOSITORY_KEY).isEmpty()).thenReturn(true); - - boolean shouldExecute = pmdSensor.shouldExecuteOnProject(project); - - assertThat(shouldExecute).isFalse(); - } - - @Test - public void should_report_violations() { - IRuleViolation pmdViolation = violation(); - Report report = report(pmdViolation); - when(executor.execute()).thenReturn(report); - when(pmdViolationToRuleViolation.toViolation(pmdViolation, sensorContext)).thenReturn(violation); - - pmdSensor.analyse(project, sensorContext); - - verify(sensorContext).saveViolation(violation); - } - - @Test - public void shouldnt_report_zero_violation() { - Report report = report(); - when(executor.execute()).thenReturn(report); - - pmdSensor.analyse(project, sensorContext); - - verifyZeroInteractions(sensorContext); - } - - @Test - public void shouldnt_report_invalid_violation() { - IRuleViolation pmdViolation = violation(); - Report report = report(pmdViolation); - when(executor.execute()).thenReturn(report); - when(report.iterator()).thenReturn(Iterators.forArray(pmdViolation)); - when(pmdViolationToRuleViolation.toViolation(pmdViolation, sensorContext)).thenReturn(null); - - pmdSensor.analyse(project, sensorContext); - - verifyZeroInteractions(sensorContext); - } - - @Test - public void should_report_analyse_failure() { - when(executor.execute()).thenThrow(new RuntimeException()); - - exception.expect(XmlParserException.class); - - pmdSensor.analyse(project, sensorContext); - } - - @Test - public void should_to_string() { - String toString = pmdSensor.toString(); - - assertThat(toString).isEqualTo("PmdSensor"); - } - - static IRuleViolation violation() { - return mock(IRuleViolation.class); - } - - static Report report(IRuleViolation... violations) { - Report report = mock(Report.class); - when(report.iterator()).thenReturn(Iterators.forArray(violations)); - return report; - } -} diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdTemplateTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdTemplateTest.java deleted file mode 100644 index a00dbd851f1..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdTemplateTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import com.google.common.base.Charsets; -import net.sourceforge.pmd.PMD; -import net.sourceforge.pmd.PMDException; -import net.sourceforge.pmd.RuleContext; -import net.sourceforge.pmd.RuleSets; -import net.sourceforge.pmd.SourceType; -import org.junit.Test; -import org.sonar.api.resources.InputFile; -import org.sonar.api.utils.SonarException; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.InputStream; - -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class PmdTemplateTest { - InputFile inputFile = mock(InputFile.class); - RuleSets rulesets = mock(RuleSets.class); - RuleContext ruleContext = mock(RuleContext.class); - InputStream inputStream = mock(InputStream.class); - PMD pmd = mock(PMD.class); - - @Test - public void should_process_input_file() throws PMDException, FileNotFoundException { - when(inputFile.getFile()).thenReturn(new File("source.java")); - when(inputFile.getInputStream()).thenReturn(inputStream); - - new PmdTemplate(pmd).process(inputFile, Charsets.UTF_8, rulesets, ruleContext); - - verify(ruleContext).setSourceCodeFilename(new File("source.java").getAbsolutePath()); - verify(pmd).processFile(inputStream, Charsets.UTF_8.displayName(), rulesets, ruleContext); - } - - @Test - public void should_ignore_PMD_error() throws PMDException, FileNotFoundException { - when(inputFile.getFile()).thenReturn(new File("source.java")); - when(inputFile.getInputStream()).thenReturn(inputStream); - doThrow(new PMDException("BUG")).when(pmd).processFile(inputStream, Charsets.UTF_8.displayName(), rulesets, ruleContext); - - new PmdTemplate(pmd).process(inputFile, Charsets.UTF_8, rulesets, ruleContext); - } - - @Test - public void should_set_java11_version() { - PmdTemplate.setJavaVersion(pmd, "1.1"); - - verify(pmd).setJavaVersion(SourceType.JAVA_13); - } - - @Test - public void should_set_java12_version() { - PmdTemplate.setJavaVersion(pmd, "1.2"); - - verify(pmd).setJavaVersion(SourceType.JAVA_13); - } - - @Test - public void should_set_java5_version() { - PmdTemplate.setJavaVersion(pmd, "5"); - - verify(pmd).setJavaVersion(SourceType.JAVA_15); - } - - @Test - public void should_set_java6_version() { - PmdTemplate.setJavaVersion(pmd, "6"); - - verify(pmd).setJavaVersion(SourceType.JAVA_16); - } - - @Test(expected = SonarException.class) - public void should_fail_on_invalid_java_version() { - new PmdTemplate("12.2"); - } - - @Test - public void shouldnt_fail_on_valid_java_version() { - new PmdTemplate("6"); - } -} diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdUnitTestsRuleRepositoryTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdUnitTestsRuleRepositoryTest.java deleted file mode 100644 index e0dc1d3d749..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdUnitTestsRuleRepositoryTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import org.junit.Before; -import org.junit.Test; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.XMLRuleParser; -import org.sonar.test.i18n.RuleRepositoryTestHelper; - -import java.util.List; - -import static org.fest.assertions.Assertions.assertThat; - -public class PmdUnitTestsRuleRepositoryTest { - PmdUnitTestsRuleRepository repository; - - @Before - public void setUpRuleRepository() { - repository = new PmdUnitTestsRuleRepository(new XMLRuleParser()); - } - - @Test - public void should_have_correct_name_and_key() { - assertThat(repository.getKey()).isEqualTo("pmd-unit-tests"); - assertThat(repository.getLanguage()).isEqualTo("java"); - assertThat(repository.getName()).isEqualTo("PMD Unit Tests"); - } - - @Test - public void should_load_repository_from_xml() { - List rules = repository.createRules(); - - assertThat(rules).onProperty("key").containsOnly( - "JUnitStaticSuite", - "JUnitSpelling", - "JUnitAssertionsShouldIncludeMessage", - "JUnitTestsShouldIncludeAssert", - "TestClassWithoutTestCases", - "UnnecessaryBooleanAssertion", - "UseAssertEqualsInsteadOfAssertTrue", - "UseAssertSameInsteadOfAssertTrue", - "UseAssertNullInsteadOfAssertTrue", - "SimplifyBooleanAssertion"); - } - - @Test - public void should_provide_a_name_and_description_for_each_rule() { - List rules = RuleRepositoryTestHelper.createRulesWithNameAndDescription("pmd", repository); - - assertThat(rules).onProperty("name").excludes(null, ""); - assertThat(rules).onProperty("description").excludes(null, ""); - } -} diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdVersionTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdVersionTest.java deleted file mode 100644 index c373456029c..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdVersionTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import org.junit.Test; - -import static org.fest.assertions.Assertions.assertThat; - -public class PmdVersionTest { - @Test - public void should_get_pmd_version() { - assertThat(PmdVersion.getVersion()).isNotEmpty(); - } -} diff --git a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdViolationToRuleViolationTest.java b/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdViolationToRuleViolationTest.java deleted file mode 100644 index 0a2d19eeac9..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/java/org/sonar/plugins/pmd/PmdViolationToRuleViolationTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Sonar, open source software quality management tool. - * Copyright (C) 2008-2012 SonarSource - * mailto:contact AT sonarsource DOT com - * - * Sonar is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * Sonar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with Sonar; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.pmd; - -import net.sourceforge.pmd.IRuleViolation; -import net.sourceforge.pmd.Rule; -import org.junit.Test; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.resources.JavaFile; -import org.sonar.api.resources.ProjectFileSystem; -import org.sonar.api.rules.RuleFinder; -import org.sonar.api.rules.Violation; - -import java.io.File; -import java.util.Arrays; - -import static org.fest.assertions.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static org.sonar.test.MoreConditions.reflectionEqualTo; - -public class PmdViolationToRuleViolationTest { - private org.sonar.api.rules.Rule sonarRule = org.sonar.api.rules.Rule.create("pmd", "RULE"); - private ProjectFileSystem projectFileSystem = mock(ProjectFileSystem.class); - private IRuleViolation pmdViolation = mock(IRuleViolation.class); - private SensorContext context = mock(SensorContext.class); - private RuleFinder ruleFinder = mock(RuleFinder.class); - private Rule rule = mock(Rule.class); - - @Test - public void should_convert_pmd_violation_to_sonar_violation() { - when(projectFileSystem.getSourceDirs()).thenReturn(Arrays.asList(new File("/src"))); - when(pmdViolation.getFilename()).thenReturn("/src/source.java"); - when(pmdViolation.getBeginLine()).thenReturn(42); - when(pmdViolation.getDescription()).thenReturn("Description"); - when(pmdViolation.getRule()).thenReturn(rule); - when(rule.getName()).thenReturn("RULE"); - when(context.getResource(new JavaFile("[default].source"))).thenReturn(new JavaFile("[default].source")); - when(ruleFinder.findByKey("pmd", "RULE")).thenReturn(sonarRule); - - PmdViolationToRuleViolation pmdViolationToRuleViolation = new PmdViolationToRuleViolation(projectFileSystem, ruleFinder); - Violation violation = pmdViolationToRuleViolation.toViolation(pmdViolation, context); - - assertThat(violation).is(reflectionEqualTo(Violation.create(sonarRule, new JavaFile("[default].source")).setLineId(42).setMessage("Description"))); - } - - @Test - public void should_ignore_violation_on_unknown_resource() { - when(projectFileSystem.getSourceDirs()).thenReturn(Arrays.asList(new File("/src"))); - when(pmdViolation.getFilename()).thenReturn("/src/UNKNOWN.java"); - - PmdViolationToRuleViolation pmdViolationToRuleViolation = new PmdViolationToRuleViolation(projectFileSystem, ruleFinder); - Violation violation = pmdViolationToRuleViolation.toViolation(pmdViolation, context); - - assertThat(violation).isNull(); - } - - @Test - public void should_ignore_violation_on_unknown_rule() { - when(projectFileSystem.getTestDirs()).thenReturn(Arrays.asList(new File("/test"))); - when(pmdViolation.getFilename()).thenReturn("/test/source.java"); - when(pmdViolation.getRule()).thenReturn(rule); - when(rule.getName()).thenReturn("UNKNOWN"); - when(context.getResource(new JavaFile("[default].source"))).thenReturn(new JavaFile("[default].source")); - - PmdViolationToRuleViolation pmdViolationToRuleViolation = new PmdViolationToRuleViolation(projectFileSystem, ruleFinder); - Violation violation = pmdViolationToRuleViolation.toViolation(pmdViolation, context); - - assertThat(violation).isNull(); - } -} diff --git a/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/complex-with-unknown-nodes.xml b/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/complex-with-unknown-nodes.xml deleted file mode 100644 index 76a2501ee63..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/complex-with-unknown-nodes.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Sonar PMD rules - to exclude - to include - - rule description - 2 - - - - - an example - - - 3 - - - - - - 4 - - - - \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/export_simple.xml b/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/export_simple.xml deleted file mode 100644 index 4bf950da263..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/export_simple.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - 2 - - - - - - 3 - - - 4 - - - diff --git a/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/export_xpath_rules.xml b/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/export_xpath_rules.xml deleted file mode 100644 index 049f9f4558d..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/export_xpath_rules.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - 3 - - - - - - - - diff --git a/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/junit.xml b/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/junit.xml deleted file mode 100644 index f07fbeb4615..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/junit.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - Sonar PMD Unit Tests rules - - 2 - - \ No newline at end of file diff --git a/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/rules-extension.xml b/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/rules-extension.xml deleted file mode 100644 index 5b560d6bce4..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/rules-extension.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - MAJOR - rulesets.xml/extension - - diff --git a/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/simple.xml b/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/simple.xml deleted file mode 100644 index 43a25104a49..00000000000 --- a/plugins/sonar-pmd-plugin/src/test/resources/org/sonar/plugins/pmd/simple.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - Sonar PMD rules - - 2 - - - - - - - - - - - 4 - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 398f5f45d2f..791584db604 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,6 @@ plugins/sonar-core-plugin plugins/sonar-dbcleaner-plugin plugins/sonar-checkstyle-plugin - plugins/sonar-pmd-plugin plugins/sonar-cobertura-plugin plugins/sonar-surefire-plugin plugins/sonar-findbugs-plugin @@ -618,6 +617,11 @@ sonar-squid-java-plugin ${sonarJava.version} + + org.codehaus.sonar-plugins.java + sonar-pmd-plugin + ${sonarJava.version} + asm asm-all diff --git a/sonar-application/pom.xml b/sonar-application/pom.xml index 60865f79489..e28f0c264c2 100644 --- a/sonar-application/pom.xml +++ b/sonar-application/pom.xml @@ -100,9 +100,8 @@ runtime - org.codehaus.sonar.plugins + org.codehaus.sonar-plugins.java sonar-pmd-plugin - ${project.version} runtime diff --git a/sonar-server/pom.xml b/sonar-server/pom.xml index 6a6b4624d31..24cb8024005 100644 --- a/sonar-server/pom.xml +++ b/sonar-server/pom.xml @@ -426,9 +426,9 @@ provided - org.codehaus.sonar.plugins + org.codehaus.sonar-plugins.java sonar-pmd-plugin - ${project.version} + ${sonarJava.version} sonar-plugin provided -- 2.39.5