├── .gitattributes ├── .github ├── scripts │ └── maven-build └── workflows │ └── ci-build.yml ├── .gitignore ├── CODEOWNERS ├── LICENSE ├── README.md ├── codestyle ├── pom.xml └── src │ └── main │ └── resources │ ├── openhab.importorder │ ├── openhab_codestyle.xml │ ├── openhab_wst_feature_file.prefs │ └── openhab_wst_xml_files.prefs ├── custom-checks ├── checkstyle │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── openhab │ │ │ └── tools │ │ │ └── analysis │ │ │ ├── checkstyle │ │ │ ├── AuthorContributionDescriptionCheck.java │ │ │ ├── AuthorTagCheck.java │ │ │ ├── AvoidScheduleAtFixedRateCheck.java │ │ │ ├── DeclarativeServicesDependencyInjectionCheck.java │ │ │ ├── ForbiddenPackageUsageCheck.java │ │ │ ├── InheritDocCheck.java │ │ │ ├── JavadocMethodStyleCheck.java │ │ │ ├── KarafAddonFeatureCheck.java │ │ │ ├── KarafFeatureCheck.java │ │ │ ├── MissingJavadocFilterCheck.java │ │ │ ├── NoEmptyLineSeparatorCheck.java │ │ │ ├── NullAnnotationsCheck.java │ │ │ ├── OhInfXmlLabelCheck.java │ │ │ ├── OhInfXmlUsageCheck.java │ │ │ ├── OhInfXmlValidationCheck.java │ │ │ ├── OnlyTabIndentationCheck.java │ │ │ ├── OverridingParentPomConfigurationCheck.java │ │ │ ├── ParameterizedRegexpHeaderCheck.java │ │ │ ├── PomXmlCheck.java │ │ │ ├── RequiredFilesCheck.java │ │ │ ├── api │ │ │ │ ├── AbstractOhInfXmlCheck.java │ │ │ │ ├── AbstractStaticCheck.java │ │ │ │ ├── AbstractStaticCheckTest.java │ │ │ │ ├── CheckConstants.java │ │ │ │ └── NoResultException.java │ │ │ └── readme │ │ │ │ ├── MarkdownCheck.java │ │ │ │ ├── MarkdownVisitor.java │ │ │ │ └── MarkdownVisitorCallback.java │ │ │ └── utils │ │ │ ├── CachingHttpClient.java │ │ │ ├── ContentReceivedCallback.java │ │ │ └── SatCheckUtils.java │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── openhab │ │ │ └── tools │ │ │ └── analysis │ │ │ ├── checkstyle │ │ │ └── test │ │ │ │ ├── AuthorContributionDescriptionCheckTest.java │ │ │ │ ├── AuthorTagCheckTest.java │ │ │ │ ├── AvoidScheduleAtFixedRateCheckTest.java │ │ │ │ ├── DeclarativeServicesDependencyInjectionCheckTest.java │ │ │ │ ├── ForbiddenPackageUsageCheckTest.java │ │ │ │ ├── InheritDocCheckTest.java │ │ │ │ ├── JavadocMethodStyleCheckTest.java │ │ │ │ ├── KarafAddonFeatureCheckTest.java │ │ │ │ ├── KarafFeatureCheckTest.java │ │ │ │ ├── LoggedMessagesExtension.java │ │ │ │ ├── MarkdownCheckTest.java │ │ │ │ ├── MissingJavadocFilterCheckTest.java │ │ │ │ ├── NoEmptyLineSeparatorCheckTest.java │ │ │ │ ├── NullAnnotationsCheckTest.java │ │ │ │ ├── OhInfXmlLabelCheckTest.java │ │ │ │ ├── OhInfXmlUsageCheckTest.java │ │ │ │ ├── OhInfXmlValidationCheckTest.java │ │ │ │ ├── OnlyTabIndentationCheckTest.java │ │ │ │ ├── OverridingParentPomConfigurationCheckTest.java │ │ │ │ ├── ParameterizedRegexpHeaderCheckTest.java │ │ │ │ ├── PomXmlCheckTest.java │ │ │ │ └── RequiredFilesCheckTest.java │ │ │ └── utils │ │ │ └── CachingHttpClientTest.java │ │ └── resources │ │ └── checkstyle │ │ ├── ForbiddenPackageUsageCheckTest │ │ ├── file-with-exception.java │ │ ├── file-with-forbidden-package.java │ │ ├── file-with-forbidden-subpackage.java │ │ ├── file-with-multiple-forbidden-packages.java │ │ ├── file-with-multiple-packages.java │ │ ├── file-with-subpackage-with-exception.java │ │ └── validFile.java │ │ ├── authorContributionDescriptionCheckTest │ │ ├── NoContributionDescriptionFirstAuthorOtherAuthor.java │ │ ├── NoContributionDescriptionOtherAuthorFirstAuthor.java │ │ ├── NoContributionDescriptions.java │ │ ├── NoFirstAuthorContributionDescriptionInnerClass.java │ │ ├── NoFirstAuthorContributionDescriptions.java │ │ ├── NoOtherAuthorContributionDescriptionInnerClass.java │ │ ├── NoOtherAuthorContributionDescriptions.java │ │ ├── PresentContributionDescriptions.java │ │ ├── WrongFirstAuthorContributionDescription.java │ │ └── WrongOtherAuthorContributionDescription.java │ │ ├── authorTagCheckTest │ │ ├── NoAuthorOuterAndInnerClasses.java │ │ ├── NoJavaDocOuterAndInnerClasses.java │ │ └── PresentAuthorTagOuterAndInnerClasses.java │ │ ├── avoidScheduleAtFixedRateCheckTest │ │ ├── NoScheduledExecutorServiceMethods.java │ │ ├── ScheduleAtFixedRateUsed.java │ │ └── ValidScheduleWithFixedDelay.java │ │ ├── declarativeServicesDependencyInjectionTest │ │ ├── DeclarativeServicesUsage.java │ │ ├── ImplementServiceTrackerCustomizer.java │ │ ├── ImplementServiceTrackerCustomizerGenerics.java │ │ └── UseServiceTracker.java │ │ ├── inheritDocCheckTest │ │ ├── fileWithALotOfNewLines.java │ │ ├── fileWithProblem.java │ │ ├── fileWithValidJavadoc.java │ │ ├── fileWithoutJavadoc.java │ │ └── notValidFileWithTabsAndSpaces.java │ │ ├── javadocMethodStyleCheckTest │ │ ├── MethodWithDashes.java │ │ ├── MethodWithDescriptionAndDashes.java │ │ ├── MethodWithDescriptionAndEmptyLines.java │ │ ├── MethodWithEmptyLines.java │ │ ├── MethodWithEmptyLinesAndDashes.java │ │ ├── MethodWithNoParamNameDescription.java │ │ ├── MethodWithParamDescriptionNewLine.java │ │ ├── MethodWithParamNameAndDescriptionNewLine.java │ │ ├── MethodWithProperDescriptions.java │ │ ├── MethodWithTwoEmptyLines.java │ │ └── MethodWithWrongJavadoc.java │ │ ├── karafAddonFeatureCheck │ │ ├── excludeAddonPatterns │ │ │ └── pom.xml │ │ ├── invalidBundle │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── feature │ │ │ │ └── feature.xml │ │ ├── invalidFeatureName │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── feature │ │ │ │ └── feature.xml │ │ ├── invalidFeaturesName │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── feature │ │ │ │ └── feature.xml │ │ ├── missingFeature │ │ │ └── pom.xml │ │ └── valid │ │ │ ├── pom.xml │ │ │ └── src │ │ │ └── main │ │ │ └── feature │ │ │ └── feature.xml │ │ ├── karafFeatureCheck │ │ ├── feature │ │ │ ├── feature.xml │ │ │ └── internal │ │ │ │ └── feature.xml │ │ ├── includedBundle │ │ │ └── pom.xml │ │ ├── includedBundleWithParentGroupIdOnly │ │ │ └── pom.xml │ │ ├── invalidBundle │ │ │ └── pom.xml │ │ ├── missingBundle │ │ │ └── pom.xml │ │ └── mulitpleFeatureFiles │ │ │ └── pom.xml │ │ ├── markdownCheckTest │ │ ├── org.openhab.binding.exec │ │ │ └── README.md │ │ ├── testCodeFormattedListBlock │ │ │ └── README.md │ │ ├── testCodeFormattedListElement │ │ │ └── README.md │ │ ├── testCodeSectionAtBeginningOfFile │ │ │ └── README.md │ │ ├── testCodeSectionAtEndOfFile │ │ │ └── README.md │ │ ├── testCodeSectionLineNumberError │ │ │ └── README.md │ │ ├── testComplicatedCodeBlocks │ │ │ └── README.md │ │ ├── testDocFolderCorrect │ │ │ └── README.md │ │ ├── testDocFolderWrong │ │ │ └── README.md │ │ ├── testEmphasizeItalicListElement │ │ │ └── README.md │ │ ├── testEmptyCodeSection │ │ │ └── README.md │ │ ├── testEmptyLineAfterCodeSection │ │ │ └── README.md │ │ ├── testEmptyLineAfterList │ │ │ └── README.md │ │ ├── testEmptyLineBeforeList │ │ │ └── README.md │ │ ├── testEmptyLinedCodeBlock │ │ │ └── README.md │ │ ├── testEscapedAsterisk │ │ │ └── README.md │ │ ├── testEscapedBrackets │ │ │ └── README.md │ │ ├── testEscapedCopyrightSymbol │ │ │ └── README.md │ │ ├── testEscapedHeader │ │ │ └── README.md │ │ ├── testEscapedUnderscore │ │ │ └── README.md │ │ ├── testForbiddenNodeVisit │ │ │ └── README.md │ │ ├── testHeader │ │ │ └── README.md │ │ ├── testHeaderAtEndOfFile │ │ │ └── README.md │ │ ├── testHeaderCreatedByDashesOnNextRow │ │ │ └── README.md │ │ ├── testHeaderOutOfBounds │ │ │ └── README.md │ │ ├── testLinkAsHeader │ │ │ └── README.md │ │ ├── testListAtBeginningOfFile │ │ │ └── README.md │ │ ├── testListAtEndOfFile │ │ │ └── README.md │ │ ├── testListBeginningSameAsAnotherLineBeginning │ │ │ └── README.md │ │ ├── testListFirstLineSameAsParagraph │ │ │ └── README.md │ │ ├── testListLastLineSameAsParagraph │ │ │ └── README.md │ │ ├── testListSeparation │ │ │ └── README.md │ │ ├── testListWithParagraphs │ │ │ └── README.md │ │ ├── testMultiLineListItems │ │ │ └── README.md │ │ ├── testOneElementedList │ │ │ └── README.md │ │ ├── testPreCodeSection │ │ │ └── README.md │ │ └── testValidMarkDown │ │ │ └── README.md │ │ ├── methodLimitCheckTest │ │ └── MethodLimitCheckTestFile.java │ │ ├── missingJavadocFilterCheckTest │ │ ├── MissingJavadocOuterAndInnerClass.java │ │ └── PresentJavadocOuterAndInnerClass.java │ │ ├── noEmptyLineSeparatorCheck │ │ ├── EmptyLineAfterDefaultCaseWithoutBracesAtTheEndOfSwitch.java │ │ ├── EmptyLineAfterInvalidCaseWithoutBraces.java │ │ ├── EmptyLineAfterInvalidDefaultCaseWithoutBraces.java │ │ ├── EmptyLineInCase.java │ │ ├── EmptyLineInCaseWithBraces.java │ │ ├── EmptyLineInConstructorDefinition.java │ │ ├── EmptyLineInDefault.java │ │ ├── EmptyLineInDefaultCaseWithBraces.java │ │ ├── EmptyLineInIfElseBlock.java │ │ ├── EmptyLineInInitBlocks.java │ │ ├── EmptyLineInMethodDefinition.java │ │ ├── EmptyLineInSwitchDefinition.java │ │ ├── EmptyLineInSwitchDefinitionWithBraces.java │ │ ├── EmptyLineInSynchronizedBlock.java │ │ ├── EmptyLineInTryBlock.java │ │ ├── EmptyLineInValidSwitchDefinitionWithoutBraces.java │ │ ├── EmptyLineInWhileLoop.java │ │ ├── EmptyLinesInValidSwitchDefinitionWithoutBracesWithoutDefault.java │ │ ├── EmptySingleLineBodyBlock.java │ │ ├── InvalidSwitchDefinitionWithoutBrace.java │ │ ├── MultipleEmptyLinesInSwitchWithCases.java │ │ ├── MultipleEmptyLinesInValidSwitchDefinitionWithoutBraces.java │ │ ├── NotProperlyFormattedWhileBlock.java │ │ ├── OneLineFormattedWhileBlock.java │ │ ├── ValidAnnotationInterface.java │ │ ├── ValidConstructorDefinition.java │ │ ├── ValidEmptyDefaultDefinition.java │ │ ├── ValidIfElseBlock.java │ │ ├── ValidInitBlocks.java │ │ ├── ValidMethodDefinition.java │ │ ├── ValidSwitchDefinition.java │ │ ├── ValidSwitchDefinitionWithoutBraces.java │ │ ├── ValidSynchronizedBlock.java │ │ ├── ValidTryBlock.java │ │ └── ValidWhileLoop.java │ │ ├── nullAnnotationsCheckTest │ │ ├── AboveMethodAnnotation.java │ │ ├── AnnotatedClass.java │ │ ├── BeforeVariableAnnotation.java │ │ ├── DeviceHandler.java │ │ ├── GenericsNonNullAnnotation.java │ │ ├── MethodParameterNonNullAnnotation.java │ │ ├── MethodReturnValueNonNullAnnotation.java │ │ ├── NotAnnotatedClass.java │ │ ├── NotAnnotatedClasses.java │ │ ├── NotAnnotatedEnum.java │ │ ├── NotAnnotatedInnerClasses.java │ │ ├── NotAnnotatedInterface.java │ │ └── SatisfiableResourceFilter.java │ │ ├── ohInfXmlLabelCheckTest │ │ ├── exceedsMaxLabelLength │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── invalidChannelGroupLabel │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── invalidChannelGroupTypeLabel │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── invalidChannelLabel │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── invalidChannelTypeLabel │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── invalidParameterGroupLabel │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── config │ │ │ │ └── conf.xml │ │ ├── invalidParameterLabel │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── config │ │ │ │ └── conf.xml │ │ └── invalidThingTypeLabel │ │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ └── OH-INF │ │ │ └── thing │ │ │ └── thing-types.xml │ │ ├── ohInfXmlUsageCheckTest │ │ ├── configurableService │ │ │ ├── src │ │ │ │ └── main │ │ │ │ │ └── resources │ │ │ │ │ └── OH-INF │ │ │ │ │ └── config │ │ │ │ │ └── addons.xml │ │ │ └── target │ │ │ │ └── classes │ │ │ │ └── OSGI-INF │ │ │ │ └── org.openhab.addons.xml │ │ ├── missingConfigDescriptionRef │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── missingSupportedBridgeRef │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── profileConfigDescription │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── config │ │ │ │ └── conf.xml │ │ ├── unusedBridge │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ └── unusedConfigDescription │ │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ └── OH-INF │ │ │ └── config │ │ │ └── conf.xml │ │ ├── ohInfXmlValidationCheckTest │ │ ├── emptyThingTypeXml │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── invalidAddon │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── addon │ │ │ │ └── addon.xml │ │ ├── invalidConfig │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── config │ │ │ │ └── conf.xml │ │ ├── invalidItemType │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── missingChannelTypeContent │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── missingPropertyContent │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── missingThingDescriptionsContent │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── missingThingTypeContent │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── sequenceBridgeTypeCheck │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── sequenceChannelTypeCheck │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── sequenceThingTypesCheck │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── thingTypesConfiguration │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ ├── binding │ │ │ │ └── bind.xml │ │ │ │ ├── config │ │ │ │ ├── conf.xml │ │ │ │ └── confingBind.xml │ │ │ │ ├── dummy │ │ │ │ └── dummy.xml │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── validBridgeType │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ ├── validSupportedBridgeRef │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ ├── bridge.xml │ │ │ │ └── thing-types.xml │ │ ├── validThingTypeXml │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── OH-INF │ │ │ │ └── thing │ │ │ │ └── thing-types.xml │ │ └── wrongDirectory │ │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ └── OH-INF │ │ │ └── thing-types.xml │ │ ├── onlyTabIndentationInXmlFilesCheck │ │ ├── BasicModuleHandlerFactory.xml │ │ ├── ScriptEngineManager.xml │ │ ├── WhiteSpaceUsedBeforeOpeningTagInManyLines.xml │ │ ├── WhiteSpaceUsedBeforeOpeningTagInOneLine.xml │ │ ├── WhiteSpacesNotUsedBeforeOpeningTags.xml │ │ ├── addon.xml │ │ ├── badlyFormattedJson.json │ │ ├── bridge.xml │ │ ├── i18n.xml │ │ ├── thing-types.xml │ │ └── validJson.json │ │ ├── overridingParentPomConfigurationCheckTest │ │ ├── emptyPom │ │ │ └── pom.xml │ │ ├── invalidPomConfiguration │ │ │ └── pom.xml │ │ └── missingOverridingParentPomConfiguration │ │ │ └── pom.xml │ │ ├── parameterizedRegexpHeaderCheckTest │ │ ├── CustomHeaderFormat.java │ │ ├── EmptyFile.java │ │ ├── HeaderWithWrongYear.java │ │ ├── MissingHeader.java │ │ ├── ValidHeaderJavaFile.java │ │ └── ValidHeaderXmlFile.xml │ │ ├── pomXmlCheckTest │ │ ├── invalid_parent_pom_id_directory │ │ │ └── pom.xml │ │ ├── missing_artifactId_in_pom_xml_directory │ │ │ └── pom.xml │ │ ├── missing_parent_pom_id_directory │ │ │ └── pom.xml │ │ ├── missing_version_in_pom_xml_directory │ │ │ └── pom.xml │ │ ├── pom.xml │ │ ├── pom_xml_with_different_version_than_parent │ │ │ └── pom.xml │ │ └── valid_pom_xml_directory │ │ │ └── pom.xml │ │ └── requiredFilesCheckTest │ │ ├── all_required_files_missing │ │ └── dummy.file.txt │ │ ├── missing_notice_html_directory │ │ ├── README.md │ │ ├── dummy.file.txt │ │ └── pom.xml │ │ ├── missing_pom_xml_directory │ │ ├── NOTICE │ │ ├── README.md │ │ └── dummy.file.txt │ │ ├── missing_readme_md_directory │ │ ├── NOTICE │ │ ├── dummy.file.txt │ │ └── pom.xml │ │ └── valid_directory │ │ ├── NOTICE │ │ ├── README.md │ │ ├── dummy.file.txt │ │ └── pom.xml ├── findbugs │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── openhab │ │ │ └── tools │ │ │ └── analysis │ │ │ └── findbugs │ │ │ └── CustomClassNameLengthDetector.java │ │ └── resources │ │ └── metadata │ │ └── findbugs │ │ ├── findbugs.xml │ │ └── messages.xml ├── pmd │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── openhab │ │ │ └── tools │ │ │ └── analysis │ │ │ └── pmd │ │ │ └── UseSLF4JLoggerRule.java │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── openhab │ │ │ └── tools │ │ │ └── analysis │ │ │ └── pmd │ │ │ └── test │ │ │ ├── ClasspathTest.java │ │ │ ├── CustomRulesTest.java │ │ │ └── PomTest.java │ │ └── resources │ │ ├── org │ │ └── openhab │ │ │ └── tools │ │ │ └── analysis │ │ │ └── pmd │ │ │ └── test │ │ │ └── xml │ │ │ ├── AvoidMavenPomderivedInClasspath.xml │ │ │ ├── AvoidOverridingParentPomConfiguration.xml │ │ │ └── UseSLF4JLoggerRule.xml │ │ └── pmd │ │ └── ruleset │ │ ├── classpath.xml │ │ ├── customrules.xml │ │ └── pom.xml └── pom.xml ├── docs ├── images │ ├── individual-report.PNG │ └── summary-report.PNG ├── implement-check.md ├── included-checks.md └── maven-plugin.md ├── licenses └── epl-2.0 │ ├── header.txt │ └── xml-header-style.xml ├── pom.xml ├── sat-extension ├── pom.xml └── src │ └── main │ └── java │ └── org │ └── openhab │ └── tools │ └── analysis │ └── report │ ├── SummaryReportExecutionListener.java │ ├── SummaryReportHtmlGenerator.java │ └── SummaryReportLifecycleParticipant.java ├── sat-plugin ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── openhab │ │ │ └── tools │ │ │ └── analysis │ │ │ ├── report │ │ │ ├── ReportMojo.java │ │ │ ├── ReportUtil.java │ │ │ └── SummaryHtmlGeneration.java │ │ │ └── tools │ │ │ ├── AbstractChecker.java │ │ │ ├── CheckstyleChecker.java │ │ │ ├── PmdChecker.java │ │ │ ├── SpotBugsChecker.java │ │ │ └── internal │ │ │ └── SpotBugsVisitors.java │ └── resources │ │ ├── configuration │ │ ├── checkstyle.properties │ │ ├── pmd.properties │ │ └── spotbugs.properties │ │ ├── report │ │ ├── create_html.xslt │ │ ├── merge.xslt │ │ ├── prepare_checkstyle.xslt │ │ ├── prepare_findbugs.xslt │ │ ├── prepare_pmd.xslt │ │ └── summary.html │ │ └── rulesets │ │ ├── checkstyle │ │ ├── rules.xml │ │ └── suppressions.xml │ │ ├── pmd │ │ ├── customrules.xml │ │ ├── rules.xml │ │ └── suppressions.properties │ │ └── spotbugs │ │ ├── exclude.xml │ │ ├── include.xml │ │ └── visitors.xml │ └── test │ ├── java │ └── org │ │ └── openhab │ │ └── tools │ │ └── analysis │ │ └── report │ │ └── ReportMojoTest.java │ └── resources │ └── report │ ├── checkstyle-result.xml │ ├── pmd.xml │ └── spotbugsXml.xml └── tools └── static-code-analysis ├── checkstyle ├── ruleset.properties └── suppressions.xml └── pmd └── suppressions.properties /.gitattributes: -------------------------------------------------------------------------------- 1 | *.java text=auto 2 | *.xml text=auto 3 | -------------------------------------------------------------------------------- /.github/scripts/maven-build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BUILD_LOG=build.log 4 | 5 | ARGUMENTS="clean verify -B -T 1.5C -U" 6 | if [ $# -ge 1 ]; then 7 | ARGUMENTS=$@ 8 | fi 9 | 10 | function print_reactor_summary() { 11 | local start_end=$(grep -anE "\[INFO\] \\-{70,}" "$BUILD_LOG" | tail -n4 | cut -f1 -d: | sed -e 1b -e '$!d' | xargs) 12 | local start=$(awk '{print $1}' <<< $start_end) 13 | local end=$(awk '{print $2}' <<< $start_end) 14 | cat "$BUILD_LOG" | sed -n "${start},${end}p" | sed 's/\[INFO\] //' 15 | } 16 | 17 | function mvnp() { 18 | set -o pipefail # exit build with error when pipes fail 19 | local reactor_size=$(find -name "pom.xml" | grep -vE '/src/|/target/' | wc -l) 20 | local padding=$(bc -l <<< "scale=0;2*(l($reactor_size)/l(10)+1)") 21 | local command=(mvn $@) 22 | exec "${command[@]}" 2>&1 | # execute, redirect stderr to stdout 23 | tee "$BUILD_LOG" | # write output to log 24 | stdbuf -oL grep -aE '^\[INFO\] Building .+ \[.+\]$' | # filter progress 25 | stdbuf -o0 sed -uE 's/^\[INFO\] Building (.*[^ ])[ ]+\[([0-9]+\/[0-9]+)\]$/\2| \1/' | # prefix project name with progress 26 | stdbuf -o0 sed -e :a -e "s/^.\{1,${padding}\}|/ &/;ta" # right align progress with padding 27 | } 28 | 29 | function build_all() { 30 | echo 31 | echo "Building all projects" 32 | echo 33 | echo "+ mvn $ARGUMENTS" 34 | echo 35 | 36 | mvnp $ARGUMENTS 37 | 38 | status=$? 39 | echo 40 | 41 | if [ $status -eq 0 ]; then 42 | print_reactor_summary 43 | else 44 | tail -n 2000 "$BUILD_LOG" 45 | fi 46 | 47 | exit $status 48 | } 49 | 50 | mvn -v 51 | build_all 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | *.log 3 | target/ 4 | 5 | # Mobile Tools for Java (J2ME) 6 | .mtj.tmp/ 7 | 8 | # Package Files # 9 | *.jar 10 | *.war 11 | *.ear 12 | 13 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 14 | hs_err_pid* 15 | 16 | # IntelliJ IDEA 17 | .idea 18 | *.iml 19 | 20 | # Eclipse 21 | .classpath 22 | .project 23 | .settings 24 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # This file helps GitHub doing automatic review requests for new PRs. 2 | # It should always list the active maintainers of the static code analysis. 3 | 4 | # Assign all PRs to the static code analysis maintainers: 5 | * @openhab/sat-maintainers 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Static Code Analysis Tool 2 | 3 | [![GitHub Actions Build Status](https://github.com/openhab/static-code-analysis/actions/workflows/ci-build.yml/badge.svg?branch=main)](https://github.com/openhab/static-code-analysis/actions/workflows/ci-build.yml) 4 | [![Jenkins Build Status](https://ci.openhab.org/job/static-code-analysis/badge/icon)](https://ci.openhab.org/job/static-code-analysis/) 5 | [![EPL-2.0](https://img.shields.io/badge/license-EPL%202-green.svg)](https://opensource.org/licenses/EPL-2.0) 6 | 7 | The Static Code Analysis Tools is a Maven plugin that executes the Maven plugins for SpotBugs, Checkstyle and PMD and generates a merged .html report. 8 | It is especially designed for openHAB to respect the defined coding guidelines. 9 | 10 | This project contains: 11 | 12 | - properties files for the PMD, Checkstyle and SpotBugs Maven plugins configuration in the `sat-plugin/src/main/resources/configuration` folder; 13 | - rule sets for the plugins in the `sat-plugin/src/main/resources/rulesets` folder; 14 | - custom rules for PMD, CheckStyle and SpotBugs and unit tests for the rules; 15 | - tool that merges the reports from the individual plugins in a summary report. 16 | 17 | ## Essentials 18 | 19 | 1. [A list of included checks.](docs/included-checks.md) 20 | 2. [How to use and configure the Static Analysis Tool.](docs/maven-plugin.md) 21 | 3. [How to integrate a new check into the tool.](docs/implement-check.md) 22 | 23 | ## 3rd Party 24 | 25 | - The example checks provided in the `static-code-analysis-config` (`MethodLimitCheck`, `CustomClassNameLengthDetector`, `WhileLoopsMustUseBracesRule`) are based on tutorials how to use the API of Checkstyle, SpotBugs and PMD. For more info, see javadoc; 26 | - The tool that merges the individual reports is based completely on source files from the https://github.com/MarkusSprunck/static-code-analysis-report that are distributed under a custom license. More information can be found in the [LICENSE](LICENSE) file. 27 | -------------------------------------------------------------------------------- /codestyle/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | org.openhab.tools.sat 9 | pom 10 | 0.18.0-SNAPSHOT 11 | 12 | 13 | org.openhab.tools 14 | openhab-codestyle 15 | jar 16 | 17 | openHAB Codestyle definitions 18 | 19 | 20 | -------------------------------------------------------------------------------- /codestyle/src/main/resources/openhab.importorder: -------------------------------------------------------------------------------- 1 | #Organize Import Order 2 | #Sun Oct 06 09:02:52 CEST 2019 3 | 0=java 4 | 1=javax 5 | 2=org 6 | 3=com 7 | 4= 8 | -------------------------------------------------------------------------------- /codestyle/src/main/resources/openhab_wst_feature_file.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | formatCommentJoinLines=false 3 | indentationChar=tab 4 | indentationSize=1 5 | lineWidth=10000 6 | outputCodeset=UTF-8 7 | spaceBeforeEmptyCloseTag=false 8 | -------------------------------------------------------------------------------- /codestyle/src/main/resources/openhab_wst_xml_files.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | formatCommentJoinLines=false 3 | indentationChar=tab 4 | indentationSize=1 5 | lineWidth=120 6 | outputCodeset=UTF-8 7 | spaceBeforeEmptyCloseTag=false 8 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/main/java/org/openhab/tools/analysis/checkstyle/AuthorTagCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.checkstyle; 14 | 15 | import com.puppycrawl.tools.checkstyle.api.DetailAST; 16 | import com.puppycrawl.tools.checkstyle.api.TokenTypes; 17 | import com.puppycrawl.tools.checkstyle.checks.javadoc.WriteTagCheck; 18 | 19 | /** 20 | * Checks if a class/interface/enumeration has an author tag 21 | * 22 | * @author Mihaela Memova - Initial contribution 23 | */ 24 | public class AuthorTagCheck extends WriteTagCheck { 25 | 26 | /** 27 | * Indicates whether the inner classes/interfaces/enumerations (briefly 28 | * called units) should be checked for an author tag. It is a configuration 29 | * property and can be changed through the check's configuration. 30 | */ 31 | private boolean checkInnerUnits; 32 | 33 | public void setCheckInnerUnits(boolean checkInnerUnits) { 34 | this.checkInnerUnits = checkInnerUnits; 35 | } 36 | 37 | /** 38 | * {@inheritDoc} 39 | *

40 | * Calls the {@link WriteTagCheck#visitToken(DetailAST)} taking into 41 | * consideration the check configuration 42 | */ 43 | @Override 44 | public void visitToken(DetailAST ast) { 45 | if (!checkInnerUnits) { 46 | DetailAST astParent = ast.getParent(); 47 | // if outer class/interface/enum 48 | if (astParent == null || astParent.getType() == TokenTypes.COMPILATION_UNIT) { 49 | super.visitToken(ast); 50 | } 51 | } else { 52 | super.visitToken(ast); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/main/java/org/openhab/tools/analysis/checkstyle/AvoidScheduleAtFixedRateCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.checkstyle; 14 | 15 | import com.puppycrawl.tools.checkstyle.api.AbstractCheck; 16 | import com.puppycrawl.tools.checkstyle.api.DetailAST; 17 | import com.puppycrawl.tools.checkstyle.api.TokenTypes; 18 | import com.puppycrawl.tools.checkstyle.utils.CommonUtil; 19 | 20 | /** 21 | * Checks the code and generates a warning if the instance method scheduleAtFixedRate 22 | * of the ScheduledExecutorService interface is used. 23 | * The preferred method to be used instead is scheduleWithFixedDelay. 24 | * 25 | * @author Lyubomir Papazov - Initial contribution 26 | */ 27 | public class AvoidScheduleAtFixedRateCheck extends AbstractCheck { 28 | 29 | private static final String WARNING_MESSAGE = "For periodically executed jobs that do not require a fixed rate scheduleWithFixedDelay should be preferred over scheduleAtFixedRate."; 30 | private static final String METHOD_TO_BE_AVOIDED = "scheduleAtFixedRate"; 31 | 32 | @Override 33 | public int[] getDefaultTokens() { 34 | return getAcceptableTokens(); 35 | } 36 | 37 | @Override 38 | public int[] getAcceptableTokens() { 39 | return new int[] { TokenTypes.METHOD_CALL }; 40 | } 41 | 42 | @Override 43 | public int[] getRequiredTokens() { 44 | return CommonUtil.EMPTY_INT_ARRAY; 45 | } 46 | 47 | @Override 48 | public void visitToken(DetailAST ast) { 49 | DetailAST fullCall = ast.findFirstToken(TokenTypes.DOT); 50 | if (fullCall != null) { 51 | DetailAST methodName = fullCall.getLastChild(); 52 | if (METHOD_TO_BE_AVOIDED.equals(methodName.getText())) { 53 | log(methodName.getLineNo(), WARNING_MESSAGE); 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/main/java/org/openhab/tools/analysis/checkstyle/MissingJavadocFilterCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.checkstyle; 14 | 15 | import com.puppycrawl.tools.checkstyle.api.DetailAST; 16 | import com.puppycrawl.tools.checkstyle.api.TokenTypes; 17 | import com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck; 18 | 19 | /** 20 | * Provides a filter that determines whether to check the inner units for a 21 | * javadoc. 22 | * 23 | * @author Petar Valchev - Initial contribution 24 | */ 25 | public class MissingJavadocFilterCheck extends MissingJavadocTypeCheck { 26 | private boolean checkInnerUnits = false; 27 | 28 | // A configuration property that determines whether to check the inner units 29 | public void setCheckInnerUnits(boolean checkInnerUnits) { 30 | this.checkInnerUnits = checkInnerUnits; 31 | } 32 | 33 | @Override 34 | public void visitToken(DetailAST ast) { 35 | if (!checkInnerUnits) { 36 | DetailAST astParent = ast.getParent(); 37 | // if outer class/interface/enum 38 | if (astParent == null || astParent.getType() == TokenTypes.COMPILATION_UNIT) { 39 | super.visitToken(ast); 40 | } 41 | } else { 42 | super.visitToken(ast); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/main/java/org/openhab/tools/analysis/checkstyle/api/CheckConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.checkstyle.api; 14 | 15 | import java.nio.file.Path; 16 | 17 | /** 18 | * Contains constants used in the implementation of checks and tests for them 19 | * 20 | * @author Svilen Valkanov - Initial contribution 21 | */ 22 | public class CheckConstants { 23 | // File extensions 24 | public static final String PROPERTIES_EXTENSION = "properties"; 25 | public static final String XML_EXTENSION = "xml"; 26 | public static final String HTML_EXTENSION = "html"; 27 | public static final String MARKDOWN_EXTENSION = "md"; 28 | public static final String JAVA_EXTENSION = "java"; 29 | 30 | // File names 31 | public static final String NOTICE_FILE_NAME = "NOTICE"; 32 | public static final String POM_XML_FILE_NAME = "pom.xml"; 33 | public static final String README_MD_FILE_NAME = "README.md"; 34 | 35 | // Directory names 36 | public static final String OSGI_INF_DIRECTORY_NAME = "OSGI-INF"; 37 | public static final String OSGI_INF_PATH = Path.of("target", "classes", OSGI_INF_DIRECTORY_NAME).toString(); 38 | 39 | public static final String OH_INF_DIRECTORY = "OH-INF"; 40 | public static final String OH_INF_PATH = Path.of("src", "main", "resources", OH_INF_DIRECTORY).toString(); 41 | } 42 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/main/java/org/openhab/tools/analysis/checkstyle/api/NoResultException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.checkstyle.api; 14 | 15 | /** 16 | * Exception that indicates that a line number was not found in a file 17 | * 18 | * @author Svilen Valkanov - Initial contribution 19 | */ 20 | public class NoResultException extends Exception { 21 | 22 | public NoResultException(String message) { 23 | super(message); 24 | } 25 | 26 | public NoResultException() { 27 | // super constructor call 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/main/java/org/openhab/tools/analysis/checkstyle/readme/MarkdownVisitorCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.checkstyle.readme; 14 | 15 | import org.openhab.tools.analysis.checkstyle.api.AbstractStaticCheck; 16 | 17 | /** 18 | * This Interface is used to make a callback in {@link MarkdownCheck}. 19 | * 20 | * @author Erdoan Hadzhiyusein - Initial contribution 21 | */ 22 | public interface MarkdownVisitorCallback { 23 | /** 24 | * This method is implemented in The {@link MarkdownCheck} class calling the protected log() of 25 | * {@link AbstractStaticCheck}. 26 | * 27 | * @param line line number of the logged message 28 | * @param message the message that is logged for the error 29 | */ 30 | void log(int line, String message); 31 | } 32 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/main/java/org/openhab/tools/analysis/utils/ContentReceivedCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.utils; 14 | 15 | /** 16 | * A callback interface for the {@link CachingHttpClient}. 17 | * 18 | * @author Svilen Valkanov - Initial contribution 19 | * 20 | * @param - the type of the object 21 | */ 22 | public interface ContentReceivedCallback { 23 | /** 24 | * Called after a successful download attempt is made by the {@link CachingHttpClient} 25 | * and should transform the data into a object of type T 26 | * 27 | * @param content HTTP request content, can`t be null 28 | * @return the transformed data 29 | */ 30 | T transform(byte[] content); 31 | } 32 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/java/org/openhab/tools/analysis/checkstyle/test/LoggedMessagesExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.checkstyle.test; 14 | 15 | import java.util.List; 16 | import java.util.stream.Collectors; 17 | 18 | import org.junit.jupiter.api.extension.AfterEachCallback; 19 | import org.junit.jupiter.api.extension.BeforeEachCallback; 20 | import org.junit.jupiter.api.extension.ExtensionContext; 21 | import org.slf4j.LoggerFactory; 22 | 23 | import ch.qos.logback.classic.Logger; 24 | import ch.qos.logback.classic.spi.ILoggingEvent; 25 | import ch.qos.logback.core.read.ListAppender; 26 | 27 | /** 28 | * An extension that stores all log messages appended by a logger during the execution of a test. 29 | * 30 | * @author Wouter Born - Initial contribution 31 | */ 32 | public class LoggedMessagesExtension implements BeforeEachCallback, AfterEachCallback { 33 | 34 | private final ListAppender listAppender = new ListAppender<>(); 35 | private final Logger logger; 36 | 37 | public LoggedMessagesExtension(Class loggerClass) { 38 | logger = (Logger) LoggerFactory.getLogger(loggerClass); 39 | } 40 | 41 | @Override 42 | public void beforeEach(ExtensionContext context) throws Exception { 43 | logger.addAppender(listAppender); 44 | listAppender.start(); 45 | } 46 | 47 | @Override 48 | public void afterEach(ExtensionContext context) throws Exception { 49 | listAppender.stop(); 50 | listAppender.list.clear(); 51 | logger.detachAppender(listAppender); 52 | } 53 | 54 | public List getMessages() { 55 | return listAppender.list.stream().map(ILoggingEvent::getMessage).collect(Collectors.toList()); 56 | } 57 | 58 | public List getFormattedMessages() { 59 | return listAppender.list.stream().map(ILoggingEvent::getFormattedMessage).collect(Collectors.toList()); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ForbiddenPackageUsageCheckTest/file-with-exception.java: -------------------------------------------------------------------------------- 1 | package org.openhab.tools.analysis.checkstyle.test; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.openhab.tools.analysis.checkstyle.ForbiddenPackageUsageCheck; 5 | import org.openhab.tools.analysis.checkstyle.InheritDocCheck; 6 | import org.openhab.tools.analysis.checkstyle.api.AbstractStaticCheckTest; 7 | import com.google.common.utils; 8 | 9 | import com.puppycrawl.tools.checkstyle.api.Configuration; 10 | import com.puppycrawl.tools.checkstyle.utils.CommonUtil; 11 | 12 | public class ForbiddenPackageUsageCheckTest extends AbstractStaticCheckTest { 13 | Configuration config = createModuleConfig(ForbiddenPackageUsageCheck.class); 14 | 15 | @Override 16 | protected String getPackageLocation() { 17 | return "checkstyle/ForbiddenPackageUsageCheckTest"; 18 | } 19 | 20 | @Test 21 | public void shouldNotLogWhenThereIsNoForbiddenPackageUsage() throws Exception { 22 | verifyClass("validFile.java", CommonUtil.EMPTY_STRING_ARRAY); 23 | } 24 | 25 | private void verifyClass(String testFileName, String[] expectedMessages) throws Exception { 26 | String absolutePathToTestFile = getPath(testFileName); 27 | verify(config, absolutePathToTestFile, expectedMessages); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ForbiddenPackageUsageCheckTest/file-with-forbidden-package.java: -------------------------------------------------------------------------------- 1 | package org.openhab.tools.analysis.checkstyle.test; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.openhab.tools.analysis.checkstyle.ForbiddenPackageUsageCheck; 5 | import org.openhab.tools.analysis.checkstyle.InheritDocCheck; 6 | import org.openhab.tools.analysis.checkstyle.api.AbstractStaticCheckTest; 7 | import com.something.something; 8 | 9 | import com.puppycrawl.tools.checkstyle.api.Configuration; 10 | import com.puppycrawl.tools.checkstyle.utils.CommonUtil; 11 | 12 | public class ForbiddenPackageUsageCheckTest extends AbstractStaticCheckTest { 13 | Configuration config = createModuleConfig(ForbiddenPackageUsageCheck.class); 14 | 15 | @Override 16 | protected String getPackageLocation() { 17 | return "checkstyle/ForbiddenPackageUsageCheckTest"; 18 | } 19 | 20 | @Test 21 | public void shouldNotLogWhenThereIsNoForbiddenPackageUsage() throws Exception { 22 | verifyClass("validFile.java", CommonUtil.EMPTY_STRING_ARRAY); 23 | } 24 | 25 | private void verifyClass(String testFileName, String[] expectedMessages) throws Exception { 26 | String absolutePathToTestFile = getPath(testFileName); 27 | verify(config, absolutePathToTestFile, expectedMessages); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ForbiddenPackageUsageCheckTest/file-with-forbidden-subpackage.java: -------------------------------------------------------------------------------- 1 | package org.openhab.tools.analysis.checkstyle.test; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.openhab.tools.analysis.checkstyle.ForbiddenPackageUsageCheck; 5 | import org.openhab.tools.analysis.checkstyle.InheritDocCheck; 6 | import org.openhab.tools.analysis.checkstyle.api.AbstractStaticCheckTest; 7 | import com.google.common.collect; 8 | 9 | import com.puppycrawl.tools.checkstyle.api.Configuration; 10 | import com.puppycrawl.tools.checkstyle.utils.CommonUtil; 11 | 12 | public class ForbiddenPackageUsageCheckTest extends AbstractStaticCheckTest { 13 | Configuration config = createModuleConfig(ForbiddenPackageUsageCheck.class); 14 | 15 | @Override 16 | protected String getPackageLocation() { 17 | return "checkstyle/ForbiddenPackageUsageCheckTest"; 18 | } 19 | 20 | @Test 21 | public void shouldNotLogWhenThereIsNoForbiddenPackageUsage() throws Exception { 22 | verifyClass("validFile.java", CommonUtil.EMPTY_STRING_ARRAY); 23 | } 24 | 25 | private void verifyClass(String testFileName, String[] expectedMessages) throws Exception { 26 | String absolutePathToTestFile = getPath(testFileName); 27 | verify(config, absolutePathToTestFile, expectedMessages); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ForbiddenPackageUsageCheckTest/file-with-multiple-forbidden-packages.java: -------------------------------------------------------------------------------- 1 | package org.openhab.tools.analysis.checkstyle.test; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.openhab.tools.analysis.checkstyle.ForbiddenPackageUsageCheck; 5 | import org.openhab.tools.analysis.checkstyle.InheritDocCheck; 6 | import org.openhab.tools.analysis.checkstyle.api.AbstractStaticCheckTest; 7 | import org.something.asd; 8 | import com.something.something; 9 | 10 | import com.puppycrawl.tools.checkstyle.api.Configuration; 11 | import com.puppycrawl.tools.checkstyle.utils.CommonUtil; 12 | 13 | public class ForbiddenPackageUsageCheckTest extends AbstractStaticCheckTest { 14 | Configuration config = createModuleConfig(ForbiddenPackageUsageCheck.class); 15 | 16 | @Override 17 | protected String getPackageLocation() { 18 | return "checkstyle/ForbiddenPackageUsageCheckTest"; 19 | } 20 | 21 | @Test 22 | public void shouldNotLogWhenThereIsNoForbiddenPackageUsage() throws Exception { 23 | verifyClass("validFile.java", CommonUtil.EMPTY_STRING_ARRAY); 24 | } 25 | 26 | private void verifyClass(String testFileName, String[] expectedMessages) throws Exception { 27 | String absolutePathToTestFile = getPath(testFileName); 28 | verify(config, absolutePathToTestFile, expectedMessages); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ForbiddenPackageUsageCheckTest/file-with-multiple-packages.java: -------------------------------------------------------------------------------- 1 | package org.openhab.tools.analysis.checkstyle.test; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.openhab.tools.analysis.checkstyle.ForbiddenPackageUsageCheck; 5 | import org.openhab.tools.analysis.checkstyle.InheritDocCheck; 6 | import org.openhab.tools.analysis.checkstyle.api.AbstractStaticCheckTest; 7 | import org.something.asd; 8 | import com.something.something; 9 | import com.google.common.utils; 10 | import com.google.common.collect; 11 | 12 | import com.puppycrawl.tools.checkstyle.api.Configuration; 13 | import com.puppycrawl.tools.checkstyle.utils.CommonUtil; 14 | 15 | public class ForbiddenPackageUsageCheckTest extends AbstractStaticCheckTest { 16 | Configuration config = createModuleConfig(ForbiddenPackageUsageCheck.class); 17 | 18 | @Override 19 | protected String getPackageLocation() { 20 | return "checkstyle/ForbiddenPackageUsageCheckTest"; 21 | } 22 | 23 | @Test 24 | public void shouldNotLogWhenThereIsNoForbiddenPackageUsage() throws Exception { 25 | verifyClass("validFile.java", CommonUtil.EMPTY_STRING_ARRAY); 26 | } 27 | 28 | private void verifyClass(String testFileName, String[] expectedMessages) throws Exception { 29 | String absolutePathToTestFile = getPath(testFileName); 30 | verify(config, absolutePathToTestFile, expectedMessages); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ForbiddenPackageUsageCheckTest/file-with-subpackage-with-exception.java: -------------------------------------------------------------------------------- 1 | package org.openhab.tools.analysis.checkstyle.test; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.openhab.tools.analysis.checkstyle.ForbiddenPackageUsageCheck; 5 | import org.openhab.tools.analysis.checkstyle.InheritDocCheck; 6 | import org.openhab.tools.analysis.checkstyle.api.AbstractStaticCheckTest; 7 | import com.google.common.utils.something; 8 | 9 | import com.puppycrawl.tools.checkstyle.api.Configuration; 10 | import com.puppycrawl.tools.checkstyle.utils.CommonUtil; 11 | 12 | public class ForbiddenPackageUsageCheckTest extends AbstractStaticCheckTest { 13 | Configuration config = createModuleConfig(ForbiddenPackageUsageCheck.class); 14 | 15 | @Override 16 | protected String getPackageLocation() { 17 | return "checkstyle/ForbiddenPackageUsageCheckTest"; 18 | } 19 | 20 | @Test 21 | public void shouldNotLogWhenThereIsNoForbiddenPackageUsage() throws Exception { 22 | verifyClass("validFile.java", CommonUtil.EMPTY_STRING_ARRAY); 23 | } 24 | 25 | private void verifyClass(String testFileName, String[] expectedMessages) throws Exception { 26 | String absolutePathToTestFile = getPath(testFileName); 27 | verify(config, absolutePathToTestFile, expectedMessages); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ForbiddenPackageUsageCheckTest/validFile.java: -------------------------------------------------------------------------------- 1 | package org.openhab.tools.analysis.checkstyle.test; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.openhab.tools.analysis.checkstyle.ForbiddenPackageUsageCheck; 5 | import org.openhab.tools.analysis.checkstyle.InheritDocCheck; 6 | import org.openhab.tools.analysis.checkstyle.api.AbstractStaticCheckTest; 7 | 8 | import com.puppycrawl.tools.checkstyle.api.Configuration; 9 | import com.puppycrawl.tools.checkstyle.utils.CommonUtil; 10 | 11 | public class ForbiddenPackageUsageCheckTest extends AbstractStaticCheckTest { 12 | Configuration config = createModuleConfig(ForbiddenPackageUsageCheck.class); 13 | 14 | @Override 15 | protected String getPackageLocation() { 16 | return "checkstyle/ForbiddenPackageUsageCheckTest"; 17 | } 18 | 19 | @Test 20 | public void shouldNotLogWhenThereIsNoForbiddenPackageUsage() throws Exception { 21 | verifyClass("validFile.java", CommonUtil.EMPTY_STRING_ARRAY); 22 | } 23 | 24 | private void verifyClass(String testFileName, String[] expectedMessages) throws Exception { 25 | String absolutePathToTestFile = getPath(testFileName); 26 | verify(config, absolutePathToTestFile, expectedMessages); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/authorContributionDescriptionCheckTest/NoContributionDescriptionFirstAuthorOtherAuthor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Pablo Diego José Francisco 3 | * @author María de los Remedios - Random contribution description 4 | * 5 | */ 6 | public class NoContributionDescriptionFirstAuthorOtherAuthor { 7 | 8 | /** 9 | * @author Cipriano de la Santísima - Initial contribution 10 | * @author Anna-María Magdalena Trinidad Ruiz y Picasso 11 | * 12 | */ 13 | private class InnerClass { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/authorContributionDescriptionCheckTest/NoContributionDescriptionOtherAuthorFirstAuthor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Pablo Diego José Francisco - Initial contribution 3 | * @author María de los Remedios 4 | * 5 | */ 6 | public class NoContributionDescriptionOtherAuthorFirstAuthor { 7 | 8 | /** 9 | * @author Cipriano de la Santísima 10 | * @author Anna-María Magdalena Trinidad Ruiz y Picasso - Changed some methods 11 | * 12 | */ 13 | private class InnerClass { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/authorContributionDescriptionCheckTest/NoContributionDescriptions.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Pablo Diego José Francisco 3 | * @author María de los Remedios 4 | * 5 | */ 6 | public class NoContributionDescriptions { 7 | 8 | /** 9 | * @author Cipriano de la Santísima 10 | * @author Anna-María Magdalena Trinidad Ruiz y Picasso 11 | * 12 | */ 13 | private class InnerClass { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/authorContributionDescriptionCheckTest/NoFirstAuthorContributionDescriptionInnerClass.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Pablo Diego José Francisco - Initial contribution 3 | * @author María de los Remedios - Added some tests 4 | * 5 | */ 6 | public class NoFirstAuthorContributionDescriptionInnerClass { 7 | 8 | /** 9 | * @author Cipriano de la Santísima 10 | * @author Anna-María Magdalena Trinidad Ruiz y Picasso - Changed some methods 11 | * 12 | */ 13 | private class InnerClass { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/authorContributionDescriptionCheckTest/NoFirstAuthorContributionDescriptions.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Pablo Diego José Francisco 3 | * @author María de los Remedios - Added some tests 4 | * 5 | */ 6 | public class NoFirstAuthorContributionDescriptions { 7 | 8 | /** 9 | * @author Cipriano de la Santísima 10 | * @author Anna-María Magdalena Trinidad Ruiz y Picasso - Changed some methods 11 | * 12 | */ 13 | private class InnerClass { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/authorContributionDescriptionCheckTest/NoOtherAuthorContributionDescriptionInnerClass.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Pablo Diego José Francisco - Initial contribution 3 | * @author María de los Remedios - Changed some methods 4 | * 5 | */ 6 | public class NoOtherAuthorContributionDescriptionInnerClass { 7 | 8 | /** 9 | * @author Cipriano de la Santísima - Initial contribution 10 | * @author Anna-María Magdalena Trinidad Ruiz y Picasso 11 | * 12 | */ 13 | private class InnerClass { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/authorContributionDescriptionCheckTest/NoOtherAuthorContributionDescriptions.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Pablo Diego José Francisco - Initial contribution 3 | * @author María de los Remedios 4 | * 5 | */ 6 | public class NoOtherAuthorContributionDescriptions { 7 | 8 | /** 9 | * @author Cipriano de la Santísima - Initial contribution 10 | * @author Anna-María Magdalena Trinidad Ruiz y Picasso 11 | * 12 | */ 13 | private class InnerClass { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/authorContributionDescriptionCheckTest/PresentContributionDescriptions.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Pablo Diego José Francisco - Initial contribution 3 | * @author María de los Remedios - Added some tests 4 | * 5 | */ 6 | public class PresentContributionDesciptions { 7 | 8 | /** 9 | * @author Cipriano de la Santísima - Initial contribution 10 | * @author Anna-María Magdalena Trinidad Ruiz y Picasso - Changed some methods 11 | * 12 | */ 13 | private class InnerClass { 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/authorContributionDescriptionCheckTest/WrongFirstAuthorContributionDescription.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Pablo Diego José Francisco - Added some methods 3 | * @author María de los Remedios - Added some tests 4 | * 5 | */ 6 | public class WrongFirstAuthorContributionDescription { 7 | 8 | } -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/authorContributionDescriptionCheckTest/WrongOtherAuthorContributionDescription.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Pablo Diego José Francisco - Initial contribution 3 | * @author María de los Remedios - 4 | * 5 | */ 6 | public class WrongOtherAuthorContributionDescription { 7 | 8 | } -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/authorTagCheckTest/NoAuthorOuterAndInnerClasses.java: -------------------------------------------------------------------------------- 1 | /** 2 | * java-doc of the outer class 3 | */ 4 | class OuterClass { 5 | 6 | /** 7 | * java-doc of the inner class 8 | */ 9 | private class InnerClass { 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/authorTagCheckTest/NoJavaDocOuterAndInnerClasses.java: -------------------------------------------------------------------------------- 1 | class NoAuthorOuterClass { 2 | 3 | private class NoAuthorInnerClass { 4 | 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/authorTagCheckTest/PresentAuthorTagOuterAndInnerClasses.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * @author Author of the outer class 4 | * 5 | */ 6 | public class OuterClass { 7 | 8 | /** 9 | * @author author of the inner class 10 | */ 11 | private class InnerClass { 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/avoidScheduleAtFixedRateCheckTest/NoScheduledExecutorServiceMethods.java: -------------------------------------------------------------------------------- 1 | import java.time.LocalDateTime; 2 | 3 | public class SuccessExaple { 4 | private static void testMethod() { 5 | LocalDateTime.now(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/avoidScheduleAtFixedRateCheckTest/ScheduleAtFixedRateUsed.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | private final ScheduledExecutorService scheduler = 3 | Executors.newScheduledThreadPool(1); 4 | 5 | public static void scheduleService() { 6 | final Runnable beeper = new Runnable() { 7 | public void run() { System.out.println("beep"); } 8 | }; 9 | 10 | final ScheduledFuture beeperHandle = 11 | scheduler.scheduleAtFixedRate(beeper, 10, 10, SECONDS); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/avoidScheduleAtFixedRateCheckTest/ValidScheduleWithFixedDelay.java: -------------------------------------------------------------------------------- 1 | public class ScheduleWithFixedDelayIsOkay { 2 | final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); 3 | 4 | public void scheduleService() { 5 | executor.scheduleWithFixedDelay(new Runnable() { 6 | int count = 0; 7 | 8 | @Override 9 | public void run() { 10 | ++count; 11 | if(count>2) { 12 | executor.shutdown(); 13 | } 14 | } 15 | }, 0, 1000, TimeUnit.MILLISECONDS); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/declarativeServicesDependencyInjectionTest/DeclarativeServicesUsage.java: -------------------------------------------------------------------------------- 1 | import org.osgi.framework.BundleContext; 2 | import org.osgi.service.log.LogService; 3 | 4 | public class DeclarativeServicesUsage { 5 | public void setLog(LogService l) { 6 | log = l; 7 | System.out.println("Log service is available!"); 8 | } 9 | 10 | public void unsetLog(LogService l) { 11 | log = null; 12 | System.out.println("Log service isn`t available anymore!"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/declarativeServicesDependencyInjectionTest/ImplementServiceTrackerCustomizer.java: -------------------------------------------------------------------------------- 1 | import org.osgi.util.tracker.ServiceTrackerCustomizer; 2 | 3 | public class ExtendServiceTrackerCustomizer implements ServiceTrackerCustomizer { 4 | @Override 5 | public Object addingService(ServiceReference reference) { 6 | } 7 | 8 | @Override 9 | public void modifiedService(ServiceReference reference, Object service) { 10 | } 11 | 12 | @Override 13 | public void removedService(ServiceReference reference, Object service) { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/declarativeServicesDependencyInjectionTest/ImplementServiceTrackerCustomizerGenerics.java: -------------------------------------------------------------------------------- 1 | import org.osgi.service.http.HttpService; 2 | import org.osgi.util.tracker.ServiceTrackerCustomizer; 3 | 4 | public class ExtendServiceTrackerCustomizer implements ServiceTrackerCustomizer { 5 | @Override 6 | public HttpService addingService(ServiceReference reference) { 7 | } 8 | 9 | @Override 10 | public void modifiedService(ServiceReference reference, Object service) { 11 | } 12 | 13 | @Override 14 | public void removedService(ServiceReference reference, Object service) { 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/declarativeServicesDependencyInjectionTest/UseServiceTracker.java: -------------------------------------------------------------------------------- 1 | import org.osgi.util.tracker.ServiceTracker; 2 | import org.osgi.framework.BundleActivator; 3 | import org.osgi.service.http.HttpService; 4 | 5 | public class UseServiceTracker implements BundleActivator { 6 | 7 | static ServiceTracker serviceTracker; 8 | org.osgi.util.tracker.ServiceTracker serviceTrackerFullName; 9 | 10 | @Override 11 | public void start(BundleContext context) throws Exception { 12 | serviceTracker = new ServiceTracker(context, HttpService.class.getName(), this); 13 | serviceTracker.open(); 14 | } 15 | 16 | @Override 17 | public void stop(BundleContext context) throws Exception { 18 | serviceTracker.close(); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/inheritDocCheckTest/fileWithALotOfNewLines.java: -------------------------------------------------------------------------------- 1 | public class InheritDocCheckTest { 2 | 3 | /** 4 | * 5 | * 6 | * 7 | * {@inheritDoc} 8 | * 9 | * 10 | * 11 | */ 12 | public void shouldLogWhenThereIsAnEmptyInheritDoc() { 13 | super.getPath(""); 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/inheritDocCheckTest/fileWithProblem.java: -------------------------------------------------------------------------------- 1 | public class InheritDocCheckTest { 2 | 3 | /** 4 | * {@inheritDoc} 5 | */ 6 | public void shouldLogWhenThereIsAnEmptyInheritDoc() { 7 | super.getPath(""); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/inheritDocCheckTest/fileWithValidJavadoc.java: -------------------------------------------------------------------------------- 1 | public class InheritDocCheckTest { 2 | 3 | /** 4 | * {@inheritDoc} 5 | * 6 | * Does something 7 | */ 8 | public void shouldLogWhenThereIsAnEmptyInheritDoc() { 9 | super.getPath(""); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/inheritDocCheckTest/fileWithoutJavadoc.java: -------------------------------------------------------------------------------- 1 | public class InheritDocCheckTest { 2 | public void shouldLogWhenThereIsAnEmptyInheritDoc() { 3 | super.getPath(""); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/inheritDocCheckTest/notValidFileWithTabsAndSpaces.java: -------------------------------------------------------------------------------- 1 | public class InheritDocCheckTest { 2 | 3 | /** 4 | * {@inheritDoc} 5 | */ 6 | public void shouldLogWhenThereIsAnEmptyInheritDoc() { 7 | super.getPath(""); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/javadocMethodStyleCheckTest/MethodWithDashes.java: -------------------------------------------------------------------------------- 1 | package checks.checkstyle.javadocCommentMethodCheckTest; 2 | 3 | public class MethodWithDashes { 4 | 5 | /** 6 | * @param watchService - the watch service, providing the watch events for the watched directory. 7 | * @param toWatch - the directory being watched by the watch service 8 | * @param registredWatchKeys - a mapping between the registered directories and their {@link WatchKey registration keys}. 9 | * @return the concrete queue reader 10 | */ 11 | protected void buildWatchQueueReader(WatchService watchService, 12 | Path toWatch, Map registredWatchKeys) { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/javadocMethodStyleCheckTest/MethodWithDescriptionAndDashes.java: -------------------------------------------------------------------------------- 1 | package checks.checkstyle.javadocCommentMethodCheckTest; 2 | 3 | public class MethodWithDescriptionAndDashes { 4 | 5 | /** 6 | * @param watchService - 7 | * the watch service, providing the watch events for the watched directory. 8 | * @param toWatch - 9 | * the directory being watched by the watch service 10 | * @param registredWatchKeys - 11 | * a mapping between the registered directories and their {@link WatchKey registration keys}. 12 | */ 13 | protected void buildWatchQueueReader(WatchService watchService, 14 | Path toWatch, Map registredWatchKeys) { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/javadocMethodStyleCheckTest/MethodWithDescriptionAndEmptyLines.java: -------------------------------------------------------------------------------- 1 | package checks.checkstyle.javadocCommentMethodCheckTest; 2 | 3 | public class MethodWithDescriptionAndEmptyLines { 4 | 5 | /** 6 | * @param watchService 7 | * the watch service 8 | * 9 | * @param watchedDir 10 | * the base directory, watched by the watch service 11 | * 12 | * @param registeredKeys 13 | * the registeredKeys 14 | */ 15 | public void AbstractWatchQueueReader(WatchService watchService, Path watchedDir, Map registeredKeys){ 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/javadocMethodStyleCheckTest/MethodWithEmptyLines.java: -------------------------------------------------------------------------------- 1 | package checks.checkstyle.javadocCommentMethodCheckTest; 2 | 3 | public class MethodWithEmptyLines { 4 | 5 | /** 6 | * @param watchService the watch service 7 | * 8 | * @param watchedDir the base directory, watched by the watch service 9 | * 10 | * @param registeredKeys registered keys 11 | */ 12 | public void AbstractWatchQueueReader(WatchService watchService, Path watchedDir, Map registeredKeys){ 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/javadocMethodStyleCheckTest/MethodWithEmptyLinesAndDashes.java: -------------------------------------------------------------------------------- 1 | package checks.checkstyle.javadocCommentMethodCheckTest; 2 | 3 | public class MethodWithEmptyLinesAndDashes { 4 | 5 | /** 6 | * @param watchService - the watch service 7 | * 8 | * @param watchedDir - the base directory, watched by the watch service 9 | * 10 | * @param registeredKeys - the registered keys 11 | */ 12 | public void AbstractWatchQueueReader(WatchService watchService, Path watchedDir, Map registeredKeys){ 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/javadocMethodStyleCheckTest/MethodWithNoParamNameDescription.java: -------------------------------------------------------------------------------- 1 | package checks.checkstyle.javadocMethodCheckTest; 2 | 3 | public class MethodWithNoParamNameDescription { 4 | 5 | /** 6 | * A method that processes watch event 7 | * 8 | * @param event 9 | * @param kind 10 | * @param name 11 | */ 12 | protected void processWatchEvent(WatchEvent event, WatchEvent.Kind kind, Path 13 | path) { 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/javadocMethodStyleCheckTest/MethodWithParamDescriptionNewLine.java: -------------------------------------------------------------------------------- 1 | package checks.checkstyle.javadocCommentMethodCheckTest; 2 | 3 | public class MethodWithParamDescriptionNewLine { 4 | 5 | /** 6 | * A method that processes watch event 7 | * 8 | * @param event 9 | * the watch event to perform 10 | * @param kind 11 | * the event’s kind 12 | * @param name 13 | * the path of the event 14 | */ 15 | protected void processWatchEvent(WatchEvent event, WatchEvent.Kind kind, Path 16 | path) { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/javadocMethodStyleCheckTest/MethodWithParamNameAndDescriptionNewLine.java: -------------------------------------------------------------------------------- 1 | package checks.checkstyle.javadocMethodCheckTest; 2 | 3 | public class MethodWithParamNameAndDescriptionNewLine { 4 | 5 | /** 6 | * Build channel ID for a control, based on control's UUID, thing's UUID and index of the channel for the control 7 | * 8 | * @param control 9 | * control to build the channel ID for 10 | * @param index 11 | * index of a channel within control (0 for primary channel) all indexes greater than 0 will have -index added to the channel ID 12 | * @return 13 | * channel ID for the control and index 14 | */ 15 | private ChannelUID getChannelIdForControl(LxControl control, int index) { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/javadocMethodStyleCheckTest/MethodWithProperDescriptions.java: -------------------------------------------------------------------------------- 1 | package checks.checkstyle.javadocCommentMethodCheckTest; 2 | 3 | public class MethodWithProperDescriptions { 4 | 5 | /** 6 | * @param watchService the watch service 7 | * @param watchedDir the base directory, watched by the watch service 8 | * @param registeredKeys the registered keys 9 | */ 10 | public void AbstractWatchQueueReader(WatchService watchService, Path watchedDir, Map registeredKeys){ 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/javadocMethodStyleCheckTest/MethodWithTwoEmptyLines.java: -------------------------------------------------------------------------------- 1 | package checks.checkstyle.javadocCommentMethodCheckTest; 2 | 3 | public class MethodWithTwoEmptyLines { 4 | 5 | /** 6 | * @param watchService the watch service 7 | * 8 | * @param watchedDir the base directory, watched by the watch service 9 | * 10 | * 11 | * @param registeredKeys the registered keys 12 | */ 13 | public void AbstractWatchQueueReader(WatchService watchService, Path watchedDir, Map registeredKeys){ 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/javadocMethodStyleCheckTest/MethodWithWrongJavadoc.java: -------------------------------------------------------------------------------- 1 | package checks.checkstyle.javadocCommentMethodCheckTest; 2 | 3 | public class MethodWithWrongJavadoc { 4 | 5 | /** 6 | * @param watchService - 7 | * the watch service 8 | * 9 | * @param watchedDir - 10 | * the base directory, watched by the watch service 11 | * 12 | * @param registeredKeys - 13 | * the registeredKeys 14 | */ 15 | public void AbstractWatchQueueReader(WatchService watchService, Path watchedDir, Map registeredKeys){ 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafAddonFeatureCheck/excludeAddonPatterns/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.addons.bundles 8 | org.openhab.addons.reactor.bundles 9 | 3.0.0-SNAPSHOT 10 | 11 | 12 | org.openhab.binding.example 13 | 14 | openHAB Add-ons :: Bundles :: Example Binding 15 | 16 | 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafAddonFeatureCheck/invalidBundle/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.addons.bundles 8 | org.openhab.addons.reactor.bundles 9 | 3.0.0-SNAPSHOT 10 | 11 | 12 | org.openhab.binding.example 13 | 14 | openHAB Add-ons :: Bundles :: Example Binding 15 | 16 | 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafAddonFeatureCheck/invalidBundle/src/main/feature/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${project.version}/xml/features 4 | 5 | 6 | openhab-runtime-base 7 | mvn:org.openhab.addons.bundles/org.openhab.binding.wrong/${project.version} 8 | 9 | 10 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafAddonFeatureCheck/invalidFeatureName/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.addons.bundles 8 | org.openhab.addons.reactor.bundles 9 | 3.0.0-SNAPSHOT 10 | 11 | 12 | org.openhab.binding.example 13 | 14 | openHAB Add-ons :: Bundles :: Example Binding 15 | 16 | 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafAddonFeatureCheck/invalidFeatureName/src/main/feature/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${project.version}/xml/features 4 | 5 | 6 | openhab-runtime-base 7 | mvn:org.openhab.addons.bundles/org.openhab.binding.example/${project.version} 8 | 9 | 10 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafAddonFeatureCheck/invalidFeaturesName/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.addons.bundles 8 | org.openhab.addons.reactor.bundles 9 | 3.0.0-SNAPSHOT 10 | 11 | 12 | org.openhab.binding.example 13 | 14 | openHAB Add-ons :: Bundles :: Example Binding 15 | 16 | 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafAddonFeatureCheck/invalidFeaturesName/src/main/feature/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${project.version}/xml/features 4 | 5 | 6 | openhab-runtime-base 7 | mvn:org.openhab.addons.bundles/org.openhab.binding.example/${project.version} 8 | 9 | 10 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafAddonFeatureCheck/missingFeature/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.addons.bundles 8 | org.openhab.addons.reactor.bundles 9 | 3.0.0-SNAPSHOT 10 | 11 | 12 | org.openhab.binding.example 13 | 14 | openHAB Add-ons :: Bundles :: Example Binding 15 | 16 | 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafAddonFeatureCheck/valid/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.addons.bundles 8 | org.openhab.addons.reactor.bundles 9 | 3.0.0-SNAPSHOT 10 | 11 | 12 | org.openhab.binding.example 13 | 14 | openHAB Add-ons :: Bundles :: Example Binding 15 | 16 | 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafAddonFeatureCheck/valid/src/main/feature/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${project.version}/xml/features 4 | 5 | 6 | openhab-runtime-base 7 | mvn:org.openhab.addons.bundles/org.openhab.binding.example/${project.version} 8 | 9 | 10 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafFeatureCheck/feature/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | openhab-runtime-base 18 | mvn:org.openhab.binding/org.openhab.binding.example/${project.version} 19 | 20 | 21 | 22 | openhab-runtime-base 23 | mvn:org.openhab.binding/org.openhab.binding.other/${project.version} 24 | 25 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafFeatureCheck/feature/internal/feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | openhab-runtime-base-extended 18 | mvn:org.openhab.binding/org.openhab.binding.example.other/${project.version} 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafFeatureCheck/includedBundle/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | 7 | org.openhab.binding 8 | pom 9 | 2.2.0-SNAPSHOT 10 | 11 | 12 | org.openhab.binding 13 | org.openhab.binding.example 14 | 2.2.0-SNAPSHOT 15 | 16 | Example Binding 17 | eclipse-plugin 18 | 19 | 20 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafFeatureCheck/includedBundleWithParentGroupIdOnly/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | 7 | org.openhab.binding 8 | pom 9 | 2.2.0-SNAPSHOT 10 | 11 | 12 | org.openhab.binding.example 13 | 2.2.0-SNAPSHOT 14 | 15 | Example Binding 16 | eclipse-plugin 17 | 18 | 19 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafFeatureCheck/invalidBundle/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | 7 | pom 8 | 2.2.0-SNAPSHOT 9 | 10 | 11 | org.openhab.binding.example 12 | 2.2.0-SNAPSHOT 13 | 14 | Example Binding 15 | eclipse-plugin 16 | 17 | 18 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafFeatureCheck/missingBundle/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | 7 | org.openhab.binding 8 | pom 9 | 2.2.0-SNAPSHOT 10 | 11 | 12 | org.openhab.binding 13 | org.openhab.binding.missing 14 | 2.2.0-SNAPSHOT 15 | 16 | Missing Example Binding 17 | eclipse-plugin 18 | 19 | 20 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/karafFeatureCheck/mulitpleFeatureFiles/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | 7 | org.openhab.binding 8 | pom 9 | 2.2.0-SNAPSHOT 10 | 11 | 12 | org.openhab.binding 13 | org.openhab.example.other 14 | 2.2.0-SNAPSHOT 15 | 16 | Missing Example Other Binding 17 | eclipse-plugin 18 | 19 | 20 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testCodeFormattedListBlock/README.md: -------------------------------------------------------------------------------- 1 | FORMAT: 1A 2 | 3 | # Eclipse SmartHome UI Logging Bundle 4 | 5 | ## Log [/rest/log/{limit}] 6 | 7 | ### Get last log messages [GET] 8 | 9 | Return the last log entries received by `/rest/log/`. 10 | 11 | 12 | + Parameters 13 | + limit (number, optional) - Limit the amount of messages. 14 | 15 | On invalid input, limit is set to it's default. 16 | 17 | + Default: 500 18 | 19 | + Response 200 (application/json) 20 | 21 | + Attributes 22 | + timestamp (number) - UTC milliseconds from the epoch. 23 | 24 | In JavaScript, you can use this value for constructing a `Date`. 25 | 26 | + severity (enum[string]) 27 | + Members 28 | + `error` 29 | + `warn` 30 | + `info` 31 | + `debug` 32 | 33 | + url (string) 34 | + message (string) 35 | 36 | + Body 37 | 38 | [ 39 | { 40 | "timestamp": 1450531459479, 41 | "severity": "error", 42 | "url": "http://example.com/page1", 43 | "message": "test 5" 44 | }, 45 | { 46 | "timestamp": 1450531459655, 47 | "severity": "error", 48 | "url": "http://example.com/page1", 49 | "message": "test 6" 50 | }, 51 | { 52 | "timestamp": 1450531460038, 53 | "severity": "error", 54 | "url": "http://example.com/page2", 55 | "message": "test 7" 56 | } 57 | ] 58 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testCodeFormattedListElement/README.md: -------------------------------------------------------------------------------- 1 | ## Thing Configuration 2 | 3 | * `controller` is a openHAB "bridge", and represents a single CoolMasterNet device. 4 | * `hvac` is an HVAC device connected to a controller. 5 | * Each device is connected. 6 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testCodeSectionAtBeginningOfFile/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | function codeSectionOnTheBeginning(){ 3 | var age= 5; 4 | var name= Michael; 5 | } 6 | ``` 7 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testCodeSectionAtEndOfFile/README.md: -------------------------------------------------------------------------------- 1 | 2 | ``` 3 | { 4 | // Start the search for new devices 5 | controllerHandler.startDeviceDiscovery(); 6 | } 7 | ``` -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testCodeSectionLineNumberError/README.md: -------------------------------------------------------------------------------- 1 | # ImperiHome integration service 2 | 3 | For example: 4 | 5 | ``` 6 | iss:room:sofa 7 | ``` 8 | 9 | If you've defined your Items in _.items_ files, tags can be added using the 10 | 11 | ``` 12 | iss:icon:sofa 13 | ``` 14 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testComplicatedCodeBlocks/README.md: -------------------------------------------------------------------------------- 1 | # Lutron Binding 2 | 3 | demo.items: 4 | 5 | ``` 6 | Dimmer TheaterLights { channel="lutron:dimmer:theater:lightlevel" } 7 | Switch TheaterMotion { channel="lutron:occupancysensor:theater:occupancystatus" } 8 | Switch TheaterScene1 { channel="lutron:keypad:theater:button1" } 9 | Switch TheaterScene2 { channel="lutron:keypad:theater:button2" } 10 | ``` 11 | 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testDocFolderCorrect/README.md: -------------------------------------------------------------------------------- 1 | # Headline 2 | 3 | ![text](doc/image.jpg) 4 | ![text](http://example.com/image.jpg) 5 | ![text](https://example.com/image.jpg) 6 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testDocFolderWrong/README.md: -------------------------------------------------------------------------------- 1 | # Headline 2 | 3 | ![text](docs/image.jpg) -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testEmphasizeItalicListElement/README.md: -------------------------------------------------------------------------------- 1 | ## Thing Configuration 2 | 3 | * controller is a openHAB, and represents a single *CoolMasterNet* device. 4 | * hv is an HVAC device *connected* to a controller. 5 | * Each device is connected. 6 | 7 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testEmptyCodeSection/README.md: -------------------------------------------------------------------------------- 1 | # Empty code section test 2 | 3 | ``` 4 | ``` 5 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testEmptyLineAfterCodeSection/README.md: -------------------------------------------------------------------------------- 1 | 2 | ``` 3 | public class ZWaveDiscoveryService extends AbstractDiscoveryService implements ExtendedDiscoveryService { 4 | private final static Logger logger = LoggerFactory.getLogger(ZWaveDiscoveryService.class); 5 | 6 | for (ZWaveNode node : controllerHandler.getNodes()) { 7 | deviceAdded(node); 8 | } 9 | 10 | // Start the search for new devices 11 | controllerHandler.startDeviceDiscovery(); 12 | } 13 | ``` 14 | here must be an empty line but it's not 15 | end -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testEmptyLineAfterList/README.md: -------------------------------------------------------------------------------- 1 | # Heading 2 | 3 | 1. Second Ordered element one 4 | 2. ordered element two 5 | 3. ordered element four 6 | - ordered sublist element 7 | - ordered sublist element two 8 | this is not a part of the list 9 | 10 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testEmptyLineBeforeList/README.md: -------------------------------------------------------------------------------- 1 | here I put some text and suddenly 2 | * list element one 3 | * list element two 4 | * list element three 5 | 6 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testEmptyLinedCodeBlock/README.md: -------------------------------------------------------------------------------- 1 | # Heading 2 | 3 | 4 | ``` 5 | { 6 | void testMethod(Test test); 7 | } 8 | 9 | 10 | 11 | ``` 12 | 13 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testEscapedAsterisk/README.md: -------------------------------------------------------------------------------- 1 | #### Title 2 | 3 | * List 4 | * Escaped\*Asterisk 5 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testEscapedBrackets/README.md: -------------------------------------------------------------------------------- 1 | #### Title 2 | 3 | \[This is not a link\](not a link) -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testEscapedCopyrightSymbol/README.md: -------------------------------------------------------------------------------- 1 | #### Example list 2 | 3 | * first 4 | * \© -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testEscapedHeader/README.md: -------------------------------------------------------------------------------- 1 | #### Configuration Options 2 | 3 | \#### Not a header in the last line -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testEscapedUnderscore/README.md: -------------------------------------------------------------------------------- 1 | #### Configuration Options 2 | 3 | * deviceId - Device Id 4 | * Device Id. House code + unit code, separated by dot. Example A.1 5 | 6 | * subType - Sub Type 7 | * Specifies device sub type. 8 | 9 | * X10 - X10 lighting 10 | * ARC - ARC 11 | * AB400D - ELRO AB400D (Flamingo) 12 | * WAVEMAN - Waveman 13 | * EMW200 - Chacon EMW200 14 | * IMPULS - IMPULS 15 | * RISINGSUN - RisingSun 16 | * PHILIPS - Philips SBC 17 | * ENERGENIE - Energenie ENER010 18 | * ENERGENIE\_5 - Energenie 5-gang 19 | * COCO - COCO GDR2-2000R 20 | * HQ\_COCO20 - HQ COCO-20 21 | 22 | 23 | ### lighting2 - RFXCOM Lighting2 Actuator 24 | 25 | A Lighting2 device. -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testForbiddenNodeVisit/README.md: -------------------------------------------------------------------------------- 1 | # Atlona Binding 2 | 3 | | Thing | Channel Type ID | Item Type | Access | Description | 4 | |---------------|----------------------------|--------------|--------|-------------------------------------------------------------------------------------------| 5 | | pro3-44m | primary#power | Switch | RW | Matrix Power Switch | 6 | | pro3-44m | primary#panellock | Switch | RW | Sets the front panel locked or unlocked | 7 | | pro3-44m | primary#irenable | Switch | RW | Enables/Disabled the front panel IR | 8 | | pro3-44m | primary#presetcmd | Switch | W | Sends a preset command ('saveX', 'recallX', 'clearX') - see notes below | 9 | | 10 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testHeader/README.md: -------------------------------------------------------------------------------- 1 | ## Discovery 2 | not an empty line obviously 3 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testHeaderAtEndOfFile/README.md: -------------------------------------------------------------------------------- 1 | # IPP Binding 2 | 3 | This binding integrates printers, which implement the Internet Printing protocol (IPP). This is the successor of the CUPS binding. 4 | The main purpose is to check if there are waiting print jobs on a printer, which can be switched on in this case. 5 | 6 | ## Full Example -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testHeaderOutOfBounds/README.md: -------------------------------------------------------------------------------- 1 | # Tankerkönig Binding 2 | 3 | 4 | ## Tankerkönig API 5 | 6 | * https://creativecommons.tankerkoenig.de/ (sorry, only available in german) 7 | 8 | [MTS-K]: 9 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testLinkAsHeader/README.md: -------------------------------------------------------------------------------- 1 | # [Homegear](https://www.homegear.eu) 2 | 3 | an example of a link as header 4 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testListAtBeginningOfFile/README.md: -------------------------------------------------------------------------------- 1 | - list element one 2 | - list element two 3 | - this list started at the beginning of the file 4 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testListAtEndOfFile/README.md: -------------------------------------------------------------------------------- 1 | # Heading 2 | 3 | 1. Second Ordered element one 4 | 2. ordered element two -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testListBeginningSameAsAnotherLineBeginning/README.md: -------------------------------------------------------------------------------- 1 | # Heading 2 | 3 | A casual paragraph starts here 4 | This is _row number two_ 5 | 6 | 1. This is _a totally different text_ 7 | 2. ordered element two 8 | 3. ordered element four 9 | - ordered sublist element 10 | - ordered sublist element two 11 | 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testListFirstLineSameAsParagraph/README.md: -------------------------------------------------------------------------------- 1 | # Heading 2 | 3 | This is some paragraph text 4 | This shouldn't cause a problem 5 | 6 | 1. This shouldn't cause a problem 7 | 2. ordered element two 8 | 3. ordered element four 9 | - ordered sublist element 10 | - ordered sublist element two 11 | 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testListLastLineSameAsParagraph/README.md: -------------------------------------------------------------------------------- 1 | # Heading 2 | 3 | This is some paragraph text 4 | This shouldn't cause a problem 5 | Some more irrelevant text 6 | 7 | 1. ordered element one 8 | 2. ordered element two 9 | 3. ordered element four 10 | - ordered sublist element 11 | - This shouldn't cause a problem 12 | 13 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testListSeparation/README.md: -------------------------------------------------------------------------------- 1 | #The lines below are rendered as one list 2 | 3 | 1. **callbackHost** 4 | Callback network address of the openHAB server, default is auto-discovery 5 | some text here 6 | 7 | 2. **xmlCallbackPort** Callback port of the XML-RPC openHAB server, default is 9125 and counts up 8 | for each additional bridge 9 | 3. **binCallbackPort** 10 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testListWithParagraphs/README.md: -------------------------------------------------------------------------------- 1 | # Homematic Binding 2 | 3 | There are several settings for a bridge 4 | 5 | - **callbackHost** Callback network address 6 | of the openHAB server, 7 | default is auto-discovery 8 | - **xmlCallbackPort** 9 | Callback port of the XML-RPC openHAB server, 10 | default is 9125 and 11 | counts up for each additional bridge 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testMultiLineListItems/README.md: -------------------------------------------------------------------------------- 1 | # Homematic Binding 2 | 3 | There are several settings for a bridge 4 | 5 | - **callbackHost** 6 | Callback network address of the openHAB server, default is auto-discovery 7 | 8 | - **xmlCallbackPort** 9 | Callback port of the XML-RPC openHAB server, default is 9125 and counts up for each additional bridge 10 | 11 | - **binCallbackPort** 12 | 13 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testOneElementedList/README.md: -------------------------------------------------------------------------------- 1 | # Feed Binding 2 | 3 | * Required configuration: 4 | 5 | * **URL** - the URL of the feed (e.g http://example.com/path/file). The binding uses this URL to download data. 6 | 7 | * Optional configuration: 8 | 9 | * **refresh** - a refresh interval defines after how many minutes the binding will check, if new content is available. Default value is 20 minutes. 10 | 11 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testPreCodeSection/README.md: -------------------------------------------------------------------------------- 1 | here is some text 2 | and before code section 3 | must be an empty line here 4 | 5 | ``` 6 | public class ZWaveDiscoveryService extends AbstractDiscoveryService implements ExtendedDiscoveryService { 7 | private final static Logger logger = LoggerFactory.getLogger(ZWaveDiscoveryService.class); 8 | 9 | private ZWaveControllerHandler controllerHandler; 10 | private DiscoveryServiceCallback discoveryServiceCallback; 11 | 12 | public ZWaveDiscoveryService(ZWaveControllerHandler coordinatorHandler, int searchTime) { 13 | super(searchTime); 14 | this.controllerHandler = coordinatorHandler; 15 | } 16 | ``` 17 | 18 | 19 | ``` 20 | public void activate() { 21 | logger.debug("Activating ZWave discovery service for {}", controllerHandler.getThing().getUID()); 22 | } 23 | 24 | @Override 25 | public void deactivate() { 26 | logger.debug("Deactivating ZWave discovery service for {}", controllerHandler.getThing().getUID()); 27 | } 28 | 29 | @Override 30 | public void setDiscoveryServiceCallback(DiscoveryServiceCallback discoveryServiceCallback) { 31 | this.discoveryServiceCallback = discoveryServiceCallback; 32 | } 33 | ``` 34 | 35 | break here... 36 | ``` 37 | @Override 38 | public Set getSupportedThingTypes() { 39 | return ZWaveConfigProvider.getSupportedThingTypes(); 40 | } 41 | 42 | @Override 43 | public void startScan() { 44 | logger.debug("Starting ZWave inclusion scan for {}", controllerHandler.getThing().getUID()); 45 | 46 | // Add all existing devices 47 | for (ZWaveNode node : controllerHandler.getNodes()) { 48 | deviceAdded(node); 49 | } 50 | 51 | // Start the search for new devices 52 | controllerHandler.startDeviceDiscovery(); 53 | } 54 | ``` 55 | 56 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/markdownCheckTest/testValidMarkDown/README.md: -------------------------------------------------------------------------------- 1 | # This is my header 2 | 3 | ``` 4 | code block 1 5 | void display() { 6 | int i; 7 | printf("["); 8 | 9 | // navigate through all items 10 | for(i = 0; i < MAX; i++) { 11 | printf("%d ",list[i]); 12 | } 13 | 14 | printf("]\n"); 15 | } 16 | ``` 17 | 18 | # Second Header 19 | 20 | ``` 21 | code block 2 22 | void display() { 23 | int i; 24 | printf("["); 25 | 26 | // navigate through all items 27 | for(i = 0; i < MAX; i++) { 28 | printf("%d ",list[i]); 29 | } 30 | 31 | printf("]\n"); 32 | } 33 | ``` 34 | 35 | - an element of a list 36 | - second element 37 | - third element -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/methodLimitCheckTest/MethodLimitCheckTestFile.java: -------------------------------------------------------------------------------- 1 | package org.openhab.core.buildtools.rules.checkstyle.test; 2 | 3 | public class MethodLimitCheckTestFile { // warn 4 | 5 | public void firstMethod() { 6 | 7 | } 8 | 9 | public void secondMethod() { 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/missingJavadocFilterCheckTest/MissingJavadocOuterAndInnerClass.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014-2016 by the respective copyright holders. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | package org.openhab.core.buildtools.rules.checkstyle.test; 9 | 10 | public class MissingJavadocOuterAndInnerClass { 11 | 12 | public class InnerClass{ 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/missingJavadocFilterCheckTest/PresentJavadocOuterAndInnerClass.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014-2016 by the respective copyright holders. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | */ 8 | package org.openhab.core.buildtools.rules.checkstyle.test; 9 | 10 | /** 11 | * 12 | * javadoc 13 | * 14 | */ 15 | public class PresentJavadocOuterAndInnerClass { 16 | 17 | /** 18 | * 19 | * javadoc 20 | * 21 | */ 22 | public class InnerClass{ 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineAfterDefaultCaseWithoutBracesAtTheEndOfSwitch.java: -------------------------------------------------------------------------------- 1 | public class EmptyLineAfterDefaultCaseWithoutBracesAtTheEndOfSwitch { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method() { 6 | switch (channelId) { 7 | case CHANNEL_WIND_DIRECTION: 8 | return new DecimalType(windDirection); 9 | 10 | case CHANNEL_AVG_WIND_SPEED: 11 | return new DecimalType(avgWindSpeed); 12 | 13 | case CHANNEL_WIND_SPEED: 14 | return new DecimalType(windSpeed); 15 | 16 | case CHANNEL_TEMPERATURE: 17 | return new DecimalType(temperature); 18 | 19 | case CHANNEL_CHILL_TEMPERATURE: 20 | return new DecimalType(chillTemperature); 21 | 22 | default: 23 | 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineAfterInvalidCaseWithoutBraces.java: -------------------------------------------------------------------------------- 1 | public class EmptyLineAfterInvalidCaseWithoutBraces { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method() { 6 | switch (channelId) { 7 | case CHANNEL_WIND_DIRECTION: 8 | return new DecimalType(windDirection); 9 | case CHANNEL_AVG_WIND_SPEED: 10 | return new DecimalType(avgWindSpeed); 11 | 12 | case CHANNEL_WIND_SPEED: 13 | return new DecimalType(windSpeed); 14 | 15 | case CHANNEL_TEMPERATURE: 16 | return new DecimalType(temperature); 17 | 18 | case CHANNEL_CHILL_TEMPERATURE: 19 | return new DecimalType(chillTemperature); 20 | 21 | case CHANNEL_CHILL_TEMPERATURE: 22 | 23 | 24 | default: break; 25 | 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineAfterInvalidDefaultCaseWithoutBraces.java: -------------------------------------------------------------------------------- 1 | public class EmptyLineAfterInvalidDefaultCaseWithoutBraces { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method() { 6 | switch (channelId) { 7 | case CHANNEL_WIND_DIRECTION: 8 | return new DecimalType(windDirection); 9 | case CHANNEL_AVG_WIND_SPEED: 10 | 11 | return new DecimalType(avgWindSpeed); 12 | 13 | case CHANNEL_WIND_SPEED: 14 | return new DecimalType(windSpeed); 15 | 16 | case CHANNEL_TEMPERATURE: 17 | return new DecimalType(temperature); 18 | 19 | case CHANNEL_CHILL_TEMPERATURE: 20 | return new DecimalType(chillTemperature); 21 | 22 | default: 23 | 24 | 25 | case CHANNEL_CHILL_TEMPERATURE: 26 | return new DecimalType(chillTemperature); 27 | 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInCase.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | int month = 2; 7 | 8 | java.util.ArrayList futureMonths = 9 | new java.util.ArrayList(); 10 | 11 | switch (month) { 12 | case 1: futureMonths.add("January"); 13 | 14 | int other = 4; 15 | case 2: futureMonths.add("February"); 16 | case 3: futureMonths.add("March"); 17 | case 4: futureMonths.add("April"); 18 | case 5: futureMonths.add("May"); 19 | case 6: futureMonths.add("June"); 20 | case 7: futureMonths.add("July"); 21 | case 8: futureMonths.add("August"); 22 | case 9: futureMonths.add("September"); 23 | case 10: futureMonths.add("October"); 24 | case 11: futureMonths.add("November"); 25 | case 12: futureMonths.add("December"); 26 | break; 27 | default: break; 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInCaseWithBraces.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | 3 | public class TestExample { 4 | 5 | // empty line after class is allowed 6 | 7 | public void method(){ 8 | int month = 2; 9 | 10 | ArrayList futureMonths = new ArrayList(); 11 | switch (month) { 12 | case 1: { 13 | 14 | futureMonths.add("January"); 15 | int other = 4; 16 | } 17 | case 2: { futureMonths.add("February");} 18 | case 3: { 19 | 20 | } 21 | case 4: { futureMonths.add("April");} 22 | case 5: { futureMonths.add("May"); 23 | break; 24 | } 25 | default: break; 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInConstructorDefinition.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | int field; 5 | 6 | 7 | public void TestExample(int field){ 8 | this.field = field; 9 | 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInDefault.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | int month = 2; 7 | 8 | java.util.ArrayList futureMonths = 9 | new java.util.ArrayList(); 10 | 11 | switch (month) { 12 | case 1: futureMonths.add("January"); 13 | int other = 4; 14 | case 2: futureMonths.add("February"); 15 | case 3: futureMonths.add("March"); 16 | case 4: futureMonths.add("April"); 17 | case 5: futureMonths.add("May"); 18 | case 6: futureMonths.add("June"); 19 | case 7: futureMonths.add("July"); 20 | case 8: futureMonths.add("August"); 21 | case 9: futureMonths.add("September"); 22 | default: break; 23 | 24 | case 10: futureMonths.add("October"); 25 | case 11: futureMonths.add("November"); 26 | case 12: futureMonths.add("December"); 27 | break; 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInDefaultCaseWithBraces.java: -------------------------------------------------------------------------------- 1 | public class EmptyLineInDefaultCaseWithBraces { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method() { 6 | 7 | switch (channelId) { 8 | 9 | case CHANNEL_WIND_DIRECTION: 10 | return new DecimalType(windDirection); 11 | 12 | case CHANNEL_AVG_WIND_SPEED: 13 | return new DecimalType(avgWindSpeed); 14 | 15 | case CHANNEL_WIND_SPEED: 16 | return new DecimalType(windSpeed); 17 | 18 | case CHANNEL_TEMPERATURE: 19 | return new DecimalType(temperature); 20 | 21 | case CHANNEL_CHILL_TEMPERATURE: { 22 | return new DecimalType(chillTemperature); 23 | } 24 | default: { 25 | 26 | return super.convertToState(channelId); 27 | 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInIfElseBlock.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | if (5 = 3) { 7 | System.out.println("hi"); 8 | 9 | return; 10 | 11 | } else if (true){ 12 | System.out.println("got it"); 13 | } else { 14 | System.out.println("finally"); 15 | } 16 | 17 | if (false){ 18 | int i = Integer.parseInt("32"); 19 | } else { 20 | 21 | System.out.println("Done"); 22 | 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInInitBlocks.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | static int i; 5 | boolean isAvailable; 6 | 7 | static { 8 | 9 | i = 2; 10 | } 11 | 12 | { 13 | 14 | isAvailable = false; 15 | 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInMethodDefinition.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | 7 | int i = 2; 8 | 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInSwitchDefinition.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | int month = 2; 7 | 8 | java.util.ArrayList futureMonths = 9 | new java.util.ArrayList(); 10 | 11 | switch (month) { 12 | 13 | case 1: futureMonths.add("January"); 14 | case 2: futureMonths.add("February"); 15 | case 3: futureMonths.add("March"); 16 | case 4: futureMonths.add("April"); 17 | case 5: futureMonths.add("May"); 18 | case 6: futureMonths.add("June"); 19 | case 7: futureMonths.add("July"); 20 | case 8: futureMonths.add("August"); 21 | case 9: futureMonths.add("September"); 22 | case 10: futureMonths.add("October"); 23 | case 11: futureMonths.add("November"); 24 | case 12: futureMonths.add("December"); 25 | break; 26 | default: break; 27 | 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInSwitchDefinitionWithBraces.java: -------------------------------------------------------------------------------- 1 | public class EmptyLineInSwitchDefinitionWithBraces { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method() { 6 | switch (channelId) { 7 | case CHANNEL_WIND_DIRECTION: 8 | return new DecimalType(windDirection); 9 | 10 | case CHANNEL_AVG_WIND_SPEED: 11 | 12 | return new DecimalType(avgWindSpeed); 13 | 14 | case CHANNEL_WIND_SPEED: { 15 | 16 | return new DecimalType(windSpeed); 17 | 18 | } 19 | 20 | case CHANNEL_TEMPERATURE: 21 | return new DecimalType(temperature); 22 | 23 | case CHANNEL_CHILL_TEMPERATURE: 24 | return new DecimalType(chillTemperature); 25 | default: 26 | return super.convertToState(channelId); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInSynchronizedBlock.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | synchronized (this) { 7 | 8 | // Important comment 9 | 10 | other(); 11 | } 12 | } 13 | 14 | public void other() { 15 | System.out.println("other"); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInTryBlock.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | try { 7 | System.out.println("hi"); 8 | 9 | return; 10 | } catch (RuntimeException e){ 11 | System.out.println("got it"); 12 | } finally { 13 | 14 | System.out.println("finally"); 15 | } 16 | 17 | 18 | try { 19 | 20 | int i = Integer.parseInt("32"); 21 | 22 | } finally { 23 | System.out.println("Done"); 24 | } 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInValidSwitchDefinitionWithoutBraces.java: -------------------------------------------------------------------------------- 1 | public class EmptyLineInValidSwitchDefinitionWithoutBraces { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method() { 6 | switch (channelId) { 7 | case CHANNEL_WIND_DIRECTION: 8 | return new DecimalType(windDirection); 9 | case CHANNEL_AVG_WIND_SPEED: 10 | return new DecimalType(avgWindSpeed); 11 | 12 | case CHANNEL_WIND_SPEED: 13 | return new DecimalType(windSpeed); 14 | 15 | case CHANNEL_TEMPERATURE: 16 | return new DecimalType(temperature); 17 | 18 | case CHANNEL_CHILL_TEMPERATURE: 19 | return new DecimalType(chillTemperature); 20 | 21 | default: break; 22 | 23 | case CHANNEL_CHILL_TEMPERATURE: 24 | return new DecimalType(chillTemperature); 25 | 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLineInWhileLoop.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | int i = 3; 7 | 8 | while(true) { 9 | i++; 10 | i*2; 11 | 12 | } 13 | 14 | do { 15 | 16 | i = 2; 17 | i = i - 2; 18 | } while (true); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptyLinesInValidSwitchDefinitionWithoutBracesWithoutDefault.java: -------------------------------------------------------------------------------- 1 | public class EmptyLinesInValidSwitchDefinitionWithoutBracesWithoutDefault { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method() { 6 | switch (channelId) { 7 | case CHANNEL_WIND_DIRECTION: 8 | return new DecimalType(windDirection); 9 | 10 | case CHANNEL_AVG_WIND_SPEED: 11 | return new DecimalType(avgWindSpeed); 12 | 13 | case CHANNEL_WIND_SPEED: 14 | return new DecimalType(windSpeed); 15 | 16 | case CHANNEL_TEMPERATURE: 17 | return new DecimalType(temperature); 18 | 19 | case CHANNEL_CHILL_TEMPERATURE: 20 | return new DecimalType(chillTemperature); 21 | case CHANNEL_COLD_TEMPERATURE: 22 | 23 | return super.convertToState(channelId); 24 | 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/EmptySingleLineBodyBlock.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | int i = 3; 7 | 8 | while(true) { 9 | 10 | } 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/InvalidSwitchDefinitionWithoutBrace.java: -------------------------------------------------------------------------------- 1 | public class InvalidSwitchDefinitionWithoutBrace { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method() { 6 | switch (channelId) { 7 | case CHANNEL_WIND_DIRECTION: 8 | return new DecimalType(windDirection); 9 | 10 | case CHANNEL_AVG_WIND_SPEED: 11 | return new DecimalType(avgWindSpeed); 12 | 13 | case CHANNEL_WIND_SPEED: 14 | return new DecimalType(windSpeed); 15 | 16 | case CHANNEL_TEMPERATURE: 17 | return new DecimalType(temperature); 18 | 19 | case CHANNEL_CHILL_TEMPERATURE: 20 | return new DecimalType(chillTemperature); 21 | default: 22 | 23 | return super.convertToState(channelId); 24 | 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/MultipleEmptyLinesInSwitchWithCases.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method() { 6 | int month = 2; 7 | 8 | java.util.ArrayList futureMonths = 9 | new java.util.ArrayList(); 10 | 11 | switch (month) { 12 | 13 | case 1: { 14 | futureMonths.add("January"); 15 | int other = 4; 16 | 17 | } 18 | case 2: 19 | 20 | int some = 5; 21 | case 3: { 22 | } 23 | case 4: { futureMonths.add("April"); } 24 | case 5: { futureMonths.add("May"); 25 | break; 26 | } 27 | 28 | default:break; 29 | 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/MultipleEmptyLinesInValidSwitchDefinitionWithoutBraces.java: -------------------------------------------------------------------------------- 1 | public class MultipleEmptyLinesInValidSwitchDefinitionWithoutBraces { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method() { 6 | switch (channelId) { 7 | case CHANNEL_WIND_DIRECTION: 8 | return new DecimalType(windDirection); 9 | case CHANNEL_AVG_WIND_SPEED: 10 | return new DecimalType(avgWindSpeed); 11 | 12 | case CHANNEL_WIND_SPEED: 13 | return new DecimalType(windSpeed); 14 | 15 | case CHANNEL_TEMPERATURE: 16 | return new DecimalType(temperature); 17 | 18 | case CHANNEL_CHILL_TEMPERATURE: 19 | return new DecimalType(chillTemperature); 20 | 21 | case CHANNEL_CHILL_TEMPERATURE: break; 22 | 23 | 24 | default: 25 | break; 26 | 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/NotProperlyFormattedWhileBlock.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | int i = 3; 7 | 8 | while(true) { 9 | doStuff();} 10 | 11 | anotherMethod(); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/OneLineFormattedWhileBlock.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | int i = 3; 7 | 8 | while(true) {doStuff();} 9 | 10 | anotherMethod(); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/ValidAnnotationInterface.java: -------------------------------------------------------------------------------- 1 | import static java.lang.annotation.ElementType.FIELD; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.FIELD) 10 | public @interface TestInterface { 11 | 12 | String property1() default ""; 13 | 14 | String property2() default ""; 15 | 16 | String property2() default ""; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/ValidConstructorDefinition.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | int field; 5 | 6 | 7 | public void TestExample(int field){ 8 | this.field = field; 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/ValidEmptyDefaultDefinition.java: -------------------------------------------------------------------------------- 1 | package org.openhab.binding.satel.internal; 2 | 3 | import org.openhab.binding.satel.command.SatelCommand; 4 | 5 | public class SatelBinding { 6 | /** 7 | * {@inheritDoc} 8 | */ 9 | @Override 10 | public boolean sendCommand(SatelCommand command) { 11 | while (!interrupted) { 12 | // wait for command state change 13 | try { 14 | synchronized (command) { 15 | command.wait(this.satelModule.getTimeout()); 16 | } 17 | } catch (InterruptedException e) { 18 | // ignore, we will leave the loop on next interruption state check 19 | interrupted = true; 20 | } 21 | // check current state 22 | switch (command.getState()) { 23 | case SUCCEEDED: 24 | return true; 25 | case FAILED: 26 | return false; 27 | default: 28 | // wait for next change unless interrupted 29 | } 30 | } 31 | return false; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/ValidIfElseBlock.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | if (5 = 3) { 7 | System.out.println("hi"); 8 | return; 9 | } else if (true){ 10 | System.out.println("got it"); 11 | } else { 12 | System.out.println("finally"); 13 | } 14 | 15 | if (false){ 16 | int i = Integer.parseInt("32"); 17 | } else { 18 | System.out.println("Done"); 19 | } 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/ValidInitBlocks.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | static int i; 5 | boolean isAvailable; 6 | 7 | static { 8 | i = 2; 9 | } 10 | 11 | { 12 | isAvailable = false; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/ValidMethodDefinition.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | int i = 2; 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/ValidSwitchDefinition.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | int month = 2; 7 | 8 | java.util.ArrayList futureMonths = 9 | new java.util.ArrayList(); 10 | 11 | switch (month) { 12 | case 1: futureMonths.add("January"); 13 | case 2: futureMonths.add("February"); 14 | case 3: futureMonths.add("March"); 15 | case 4: futureMonths.add("April"); 16 | case 5: futureMonths.add("May"); 17 | case 6: futureMonths.add("June"); 18 | case 7: futureMonths.add("July"); 19 | case 8: futureMonths.add("August"); 20 | case 9: futureMonths.add("September"); 21 | case 10: futureMonths.add("October"); 22 | case 11: futureMonths.add("November"); 23 | case 12: futureMonths.add("December"); 24 | break; 25 | default: break; 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/ValidSwitchDefinitionWithoutBraces.java: -------------------------------------------------------------------------------- 1 | public class ValidSwitchDefinitionWithoutBraces { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method() { 6 | switch (channelId) { 7 | case CHANNEL_WIND_DIRECTION: 8 | return new DecimalType(windDirection); 9 | 10 | case CHANNEL_AVG_WIND_SPEED: 11 | return new DecimalType(avgWindSpeed); 12 | 13 | case CHANNEL_WIND_SPEED: 14 | return new DecimalType(windSpeed); 15 | 16 | case CHANNEL_TEMPERATURE: 17 | return new DecimalType(temperature); 18 | 19 | case CHANNEL_CHILL_TEMPERATURE: 20 | return new DecimalType(chillTemperature); 21 | 22 | default: 23 | return super.convertToState(channelId); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/ValidSynchronizedBlock.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | synchronized (this) { 7 | // Important comment 8 | other(); 9 | } 10 | } 11 | 12 | public void other() { 13 | System.out.println("other"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/ValidTryBlock.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | try { 7 | System.out.println("hi"); 8 | return; 9 | } catch (RuntimeException e){ 10 | System.out.println("got it"); 11 | } finally { 12 | System.out.println("finally"); 13 | } 14 | 15 | 16 | try { 17 | int i = Integer.parseInt("32"); 18 | } finally { 19 | System.out.println("Done"); 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/noEmptyLineSeparatorCheck/ValidWhileLoop.java: -------------------------------------------------------------------------------- 1 | public class TestExample { 2 | 3 | // empty line after class is allowed 4 | 5 | public void method(){ 6 | int i = 3; 7 | 8 | while(true) { 9 | i++; 10 | i*2; 11 | } 12 | 13 | do { 14 | i = 2; 15 | i = i - 2; 16 | } while (true); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/nullAnnotationsCheckTest/AboveMethodAnnotation.java: -------------------------------------------------------------------------------- 1 | package checkstyle.nullAnnotationsCheckTest; 2 | 3 | import org.eclipse.jdt.annotation.NonNullByDefault; 4 | import org.eclipse.jdt.annotation.NonNull; 5 | 6 | @NonNullByDefault 7 | public class AboveMethodAnnotation { 8 | 9 | @NonNull 10 | private final NetatmoBridgeHandler netatmoBridgeHandler() { 11 | 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/nullAnnotationsCheckTest/AnnotatedClass.java: -------------------------------------------------------------------------------- 1 | package checkstyle.nullAnnotationsCheckTest; 2 | 3 | import org.eclipse.jdt.annotation.NonNullByDefault; 4 | 5 | @NonNullByDefault 6 | public class AnnotatedClass { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/nullAnnotationsCheckTest/BeforeVariableAnnotation.java: -------------------------------------------------------------------------------- 1 | package checkstyle.nullAnnotationsCheckTest; 2 | 3 | import org.eclipse.jdt.annotation.NonNullByDefault; 4 | import org.eclipse.jdt.annotation.NonNull; 5 | 6 | @NonNullByDefault 7 | public class BeforeVariableAnnotation { 8 | 9 | public static final @NonNull String BINDING_ID = "lgwebos"; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/nullAnnotationsCheckTest/DeviceHandler.java: -------------------------------------------------------------------------------- 1 | package checkstyle.nullAnnotationsCheckTest; 2 | 3 | import org.eclipse.jdt.annotation.NonNull; 4 | 5 | public class DeviceHandler { 6 | 7 | public DeviceHandler(@NonNull Thing thing) { 8 | 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/nullAnnotationsCheckTest/GenericsNonNullAnnotation.java: -------------------------------------------------------------------------------- 1 | package checkstyle.nullAnnotationsCheckTest; 2 | 3 | import org.eclipse.jdt.annotation.NonNullByDefault; 4 | import org.eclipse.jdt.annotation.NonNull; 5 | import org.eclipse.jdt.annotation.Nullable; 6 | 7 | @NonNullByDefault 8 | public class GenericsNonNullAnnotation<@Nullable U, @NonNull V> { 9 | 10 | public @Nullable List<@NonNull Class> getNullableAcceptedDataTypes() { 11 | return Collections.emptyList(); 12 | } 13 | 14 | public @NonNull List<@NonNull Class> getNonNullAcceptedDataTypes() { 15 | return Collections.emptyList(); 16 | } 17 | 18 | public <@NonNull T> T getAsType(Class type, Object object) { 19 | return (T) object; 20 | } 21 | 22 | public U getAsTypeU(@Nullable Object object) { 23 | return (U) object; 24 | } 25 | 26 | public V getAsTypeV(Object object) { 27 | return (V) object; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/nullAnnotationsCheckTest/MethodParameterNonNullAnnotation.java: -------------------------------------------------------------------------------- 1 | package checkstyle.nullAnnotationsCheckTest; 2 | 3 | import org.eclipse.jdt.annotation.NonNullByDefault; 4 | import org.eclipse.jdt.annotation.NonNull; 5 | 6 | @NonNullByDefault 7 | public class MethodParameterNonNullAnnotation { 8 | 9 | private void assertProperties(@NonNull String responseFile, @NonNull TPLinkSmartHomeThingType thingType) { 10 | 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/nullAnnotationsCheckTest/MethodReturnValueNonNullAnnotation.java: -------------------------------------------------------------------------------- 1 | package checkstyle.nullAnnotationsCheckTest; 2 | 3 | import org.eclipse.jdt.annotation.NonNullByDefault; 4 | import org.eclipse.jdt.annotation.NonNull; 5 | 6 | @NonNullByDefault 7 | public class MethodReturnValueNonNullAnnotation { 8 | 9 | @Override 10 | public @NonNull StateDescription getStateDescription(Channel channel) { 11 | 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/nullAnnotationsCheckTest/NotAnnotatedClass.java: -------------------------------------------------------------------------------- 1 | package checkstyle.nullAnnotationsCheckTest; 2 | 3 | public class NotAnnotatedClass { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/nullAnnotationsCheckTest/NotAnnotatedClasses.java: -------------------------------------------------------------------------------- 1 | package checkstyle.nullAnnotationsCheckTest; 2 | 3 | public class NotAnnotatedClasses { 4 | 5 | private class InnerClass { 6 | 7 | } 8 | 9 | private class AnotherInnerClass { 10 | 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/nullAnnotationsCheckTest/NotAnnotatedEnum.java: -------------------------------------------------------------------------------- 1 | package checkstyle.nullAnnotationsCheckTest; 2 | 3 | public enum NotAnnotatedEnum { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/nullAnnotationsCheckTest/NotAnnotatedInnerClasses.java: -------------------------------------------------------------------------------- 1 | package checkstyle.nullAnnotationsCheckTest; 2 | 3 | import org.eclipse.jdt.annotation.NonNullByDefault; 4 | 5 | @NonNullByDefault 6 | public class NotAnnotatedInnerClasses { 7 | 8 | private class InnerClass { 9 | 10 | } 11 | 12 | private class AnotherInnerClass { 13 | 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/nullAnnotationsCheckTest/NotAnnotatedInterface.java: -------------------------------------------------------------------------------- 1 | package checkstyle.nullAnnotationsCheckTest; 2 | 3 | public interface NotAnnotatedInterface { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/nullAnnotationsCheckTest/SatisfiableResourceFilter.java: -------------------------------------------------------------------------------- 1 | package checkstyle.nullAnnotationsCheckTest; 2 | 3 | import javax.ws.rs.ext.Provider; 4 | import org.osgi.service.component.annotations.Component; 5 | 6 | @Provider 7 | @Component(immediate = true, service = SatisfiableResourceFilter.class) 8 | public class SatisfiableResourceFilter implements ContainerRequestFilter { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlLabelCheckTest/exceedsMaxLabelLength/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlLabelCheckTest/invalidChannelGroupLabel/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlLabelCheckTest/invalidChannelGroupTypeLabel/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlLabelCheckTest/invalidChannelLabel/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlLabelCheckTest/invalidChannelTypeLabel/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlLabelCheckTest/invalidParameterGroupLabel/src/main/resources/OH-INF/config/conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlLabelCheckTest/invalidParameterLabel/src/main/resources/OH-INF/config/conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlLabelCheckTest/invalidThingTypeLabel/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlUsageCheckTest/configurableService/src/main/resources/OH-INF/config/addons.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | Defines whether openHAB should access the remote repository for add-on installation. 12 | true 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlUsageCheckTest/configurableService/target/classes/OSGI-INF/org.openhab.addons.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlUsageCheckTest/missingConfigDescriptionRef/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | Text 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlUsageCheckTest/missingSupportedBridgeRef/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Text 11 | 12 | 13 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlUsageCheckTest/profileConfigDescription/src/main/resources/OH-INF/config/conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | Offset (plain number or number with unit) to be applied on the state towards the item. The negative offset will be applied in the reverse direction. 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlUsageCheckTest/unusedBridge/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | Simple bridge 8 | 9 | 10 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlUsageCheckTest/unusedConfigDescription/src/main/resources/OH-INF/config/conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | String 11 | String 12 | false 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/emptyThingTypeXml/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openhab/static-code-analysis/1eac36a5098d1d4fca9d50cb4daab6aad1b696da/custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/emptyThingTypeXml/src/main/resources/OH-INF/thing/thing-types.xml -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/invalidAddon/src/main/resources/OH-INF/addon/addon.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/invalidConfig/src/main/resources/OH-INF/config/conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/invalidItemType/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Some sample description 9 | 10 | 11 | 12 | 13 | 14 | 15 | Invalid 16 | 17 | Test 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/missingChannelTypeContent/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Some sample description 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/missingPropertyContent/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Some sample description 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Text 20 | 21 | Test 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/missingThingDescriptionsContent/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/missingThingTypeContent/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/sequenceBridgeTypeCheck/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | Simple bridge 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Thing description 16 | 17 | 18 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/sequenceChannelTypeCheck/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Some sample description 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Test 18 | Text 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/sequenceThingTypesCheck/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Some sample description 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Text 17 | 18 | Test 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/thingTypesConfiguration/src/main/resources/OH-INF/binding/bind.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | binding 7 | String 8 | String 9 | String 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/thingTypesConfiguration/src/main/resources/OH-INF/config/conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | String 11 | String 12 | false 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/thingTypesConfiguration/src/main/resources/OH-INF/config/confingBind.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | String 11 | String 12 | false 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/thingTypesConfiguration/src/main/resources/OH-INF/dummy/dummy.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/thingTypesConfiguration/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Some sample description 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Text 19 | 20 | Test 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/validBridgeType/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | Simple bridge 8 | 9 | 10 | 11 | 12 | 13 | 14 | Some description 15 | 16 | 17 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/validSupportedBridgeRef/src/main/resources/OH-INF/thing/bridge.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Text 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/validSupportedBridgeRef/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Text 11 | 12 | 13 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/validThingTypeXml/src/main/resources/OH-INF/thing/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Some sample description 9 | 10 | 11 | 12 | 13 | 14 | 15 | Number:Energy 16 | 17 | Test 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/ohInfXmlValidationCheckTest/wrongDirectory/src/main/resources/OH-INF/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Some sample description 9 | 10 | 11 | 12 | 13 | 14 | 15 | Text 16 | 17 | Test 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/onlyTabIndentationInXmlFilesCheck/BasicModuleHandlerFactory.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 19 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/onlyTabIndentationInXmlFilesCheck/ScriptEngineManager.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/onlyTabIndentationInXmlFilesCheck/WhiteSpaceUsedBeforeOpeningTagInManyLines.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | org.apache.maven.plugins 5 | maven-surefire-plugin 6 | ${maven.surefire.plugin.version} 7 | 8 | 9 | org.apache.maven.plugins 10 | maven-eclipse-plugin 11 | ${maven.eclipse.version} 12 | 13 | true 14 | true 15 | 16 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/onlyTabIndentationInXmlFilesCheck/WhiteSpaceUsedBeforeOpeningTagInOneLine.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | org.apache.maven.plugins 5 | maven-surefire-plugin 6 | ${maven.surefire.plugin.version} 7 | 8 | 9 | org.apache.maven.plugins 10 | maven-eclipse-plugin 11 | ${maven.eclipse.version} 12 | 13 | true 14 | true 15 | 16 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/onlyTabIndentationInXmlFilesCheck/WhiteSpacesNotUsedBeforeOpeningTags.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/onlyTabIndentationInXmlFilesCheck/addon.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | binding 5 | OneWireGPIO Binding 6 | Use GPIO in various devices like RaspberryPi to communicate the OneWire protocol 7 | Anatol Ogorek 8 | 9 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/onlyTabIndentationInXmlFilesCheck/badlyFormattedJson.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "uid": "JsonDemoRule", 4 | "name": "DemoRule", 5 | "triggers": [ 6 | { 7 | "id": "RuleTrigger", 8 | "label": "Item State Change Trigger", 9 | "description": "This triggers a rule if an items state changed", 10 | "type": "ItemStateChangeTrigger", 11 | "configuration": { 12 | "itemName": "DemoSwitch" 13 | } 14 | } 15 | ], 16 | "actions": [ 17 | { 18 | "id": "RuleAction", 19 | "label": "Post command to an item", 20 | "description": "Posts commands on items", 21 | "type": "ItemPostCommandAction", 22 | "configuration": { 23 | "itemName": "DemoDimmer", 24 | "command": "ON" 25 | } 26 | } 27 | ] 28 | } 29 | ] -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/onlyTabIndentationInXmlFilesCheck/bridge.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/onlyTabIndentationInXmlFilesCheck/thing-types.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | OneWire GPIO Temperature sensor 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | device id in format: /sys/bus/w1/devices/DEVICE_ID_TO_SET/w1_slave 17 | 18 | 19 | 20 | 21 | Refresh time interval in seconds. 22 | 600 23 | 24 | 25 | 26 | 27 | 28 | 29 | Number 30 | 31 | Indicates the temperature read from one wire gpio sensor in Celsius 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/onlyTabIndentationInXmlFilesCheck/validJson.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "ItemSampleRule", 4 | "uid": "ItemSampleRule", 5 | "tags": [ 6 | "sample", 7 | "item", 8 | "jsonTest", 9 | "rule" 10 | ], 11 | "configuration": { 12 | 13 | }, 14 | "description": "Sample Rule for items definition.", 15 | "triggers": [ 16 | { 17 | "id": "ItemStateChangeTriggerID", 18 | "type": "core.GenericEventTrigger", 19 | "configuration": { 20 | "eventSource": "myMotionItem", 21 | "eventTopic": "smarthome/items/*", 22 | "eventTypes": "ItemStateEvent" 23 | } 24 | } 25 | ], 26 | "actions": [ 27 | { 28 | "id": "ItemPostCommandActionID", 29 | "type": "core.ItemCommandAction", 30 | "configuration": { 31 | "itemName": "myLampItem", 32 | "command": "ON" 33 | } 34 | } 35 | ] 36 | }, 37 | { 38 | "uid": "ItemSampleRuleWithReferences", 39 | "name": "ItemSampleRuleWithReferences", 40 | "templateUID": "TemplateSampleRuleWithReferences", 41 | "tags": [ 42 | "sample", 43 | "item", 44 | "jsonTest", 45 | "rule", 46 | "references" 47 | ], 48 | "configuration": { 49 | "triggerItem": "myMotionItem", 50 | "actionItem": "myLampItem" 51 | } 52 | } 53 | ] -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/overridingParentPomConfigurationCheckTest/emptyPom/pom.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openhab/static-code-analysis/1eac36a5098d1d4fca9d50cb4daab6aad1b696da/custom-checks/checkstyle/src/test/resources/checkstyle/overridingParentPomConfigurationCheckTest/emptyPom/pom.xml -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/overridingParentPomConfigurationCheckTest/invalidPomConfiguration/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | ${tycho-groupid} 7 | target-platform-configuration 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/overridingParentPomConfigurationCheckTest/missingOverridingParentPomConfiguration/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | ${tycho-groupid} 7 | target-platform-configuration 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/parameterizedRegexpHeaderCheckTest/CustomHeaderFormat.java: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2010-2017 by the respective copyright holders. 3 | // 4 | // 5 | public class CustomHeaderFormat { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/parameterizedRegexpHeaderCheckTest/EmptyFile.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openhab/static-code-analysis/1eac36a5098d1d4fca9d50cb4daab6aad1b696da/custom-checks/checkstyle/src/test/resources/checkstyle/parameterizedRegexpHeaderCheckTest/EmptyFile.java -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/parameterizedRegexpHeaderCheckTest/HeaderWithWrongYear.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2015 by the respective copyright holders. 3 | * 4 | */ 5 | 6 | public class HeaderWithWrongYear { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/parameterizedRegexpHeaderCheckTest/MissingHeader.java: -------------------------------------------------------------------------------- 1 | public class MissingHeader { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/parameterizedRegexpHeaderCheckTest/ValidHeaderJavaFile.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2017 by the respective copyright holders. 3 | * 4 | */ 5 | 6 | public class ValidHeaderJavaFile { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/parameterizedRegexpHeaderCheckTest/ValidHeaderXmlFile.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/pomXmlCheckTest/invalid_parent_pom_id_directory/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.binding 8 | invalid 9 | 2.1.0-SNAPSHOT 10 | 11 | 12 | 4.0.0 13 | org.openhab.binding 14 | org.openhab.binding.example 15 | 16 | openHAB Example Binding 17 | 18 | eclipse-plugin 19 | 20 | 21 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/pomXmlCheckTest/missing_artifactId_in_pom_xml_directory/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.binding 8 | pom 9 | 2.1.0-SNAPSHOT 10 | 11 | 12 | 4.0.0 13 | org.openhab.binding 14 | 15 | openHAB Example Binding 16 | 17 | eclipse-plugin 18 | 19 | 20 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/pomXmlCheckTest/missing_parent_pom_id_directory/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.binding 8 | 2.1.0-SNAPSHOT 9 | 10 | 11 | 4.0.0 12 | org.openhab.binding 13 | org.openhab.binding.example 14 | 15 | openHAB Example Binding 16 | 17 | eclipse-plugin 18 | 19 | 20 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/pomXmlCheckTest/missing_version_in_pom_xml_directory/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.binding 8 | pom 9 | 10 | 11 | 4.0.0 12 | org.openhab.binding 13 | org.openhab.binding.example 14 | 15 | openHAB Example Binding 16 | 17 | eclipse-plugin 18 | 19 | 20 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/pomXmlCheckTest/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 4.0.0 7 | org.openhab.binding 8 | pom 9 | 2.1.0-SNAPSHOT 10 | 11 | 12 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/pomXmlCheckTest/pom_xml_with_different_version_than_parent/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.binding 8 | pom 9 | 2.2.0-SNAPSHOT 10 | 11 | 12 | 4.0.0 13 | org.openhab.binding 14 | org.openhab.binding.example 15 | 16 | openHAB Example Binding 17 | 18 | eclipse-plugin 19 | 20 | 21 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/pomXmlCheckTest/valid_pom_xml_directory/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.binding 8 | pom 9 | 2.1.0-SNAPSHOT 10 | 11 | 12 | 4.0.0 13 | org.openhab.binding 14 | org.openhab.binding.example 15 | 16 | openHAB Example Binding 17 | 18 | eclipse-plugin 19 | 20 | 21 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/all_required_files_missing/dummy.file.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openhab/static-code-analysis/1eac36a5098d1d4fca9d50cb4daab6aad1b696da/custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/all_required_files_missing/dummy.file.txt -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_notice_html_directory/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openhab/static-code-analysis/1eac36a5098d1d4fca9d50cb4daab6aad1b696da/custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_notice_html_directory/README.md -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_notice_html_directory/dummy.file.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openhab/static-code-analysis/1eac36a5098d1d4fca9d50cb4daab6aad1b696da/custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_notice_html_directory/dummy.file.txt -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_notice_html_directory/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.core.bundles 8 | config 9 | 0.9.0-SNAPSHOT 10 | 11 | 12 | 13 | org.openhab.core.config.dispatch 14 | org.openhab.core.config.dispatch 15 | 16 | 17 | 4.0.0 18 | org.openhab.core.config 19 | org.openhab.core.config.dispatch 20 | 21 | Eclipse SmartHome Configuration Dispatcher 22 | 23 | eclipse-plugin 24 | 25 | 26 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_pom_xml_directory/NOTICE: -------------------------------------------------------------------------------- 1 | This content is produced and maintained by the openHAB project. 2 | 3 | * Project home: https://www.openhab.org 4 | 5 | == Declared Project Licenses 6 | 7 | This program and the accompanying materials are made available under the terms 8 | of the Eclipse Public License 2.0 which is available at 9 | https://www.eclipse.org/legal/epl-2.0/. 10 | 11 | == Source Code 12 | 13 | https://github.com/openhab/openhab2-addons 14 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_pom_xml_directory/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openhab/static-code-analysis/1eac36a5098d1d4fca9d50cb4daab6aad1b696da/custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_pom_xml_directory/README.md -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_pom_xml_directory/dummy.file.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openhab/static-code-analysis/1eac36a5098d1d4fca9d50cb4daab6aad1b696da/custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_pom_xml_directory/dummy.file.txt -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_readme_md_directory/NOTICE: -------------------------------------------------------------------------------- 1 | This content is produced and maintained by the openHAB project. 2 | 3 | * Project home: https://www.openhab.org 4 | 5 | == Declared Project Licenses 6 | 7 | This program and the accompanying materials are made available under the terms 8 | of the Eclipse Public License 2.0 which is available at 9 | https://www.eclipse.org/legal/epl-2.0/. 10 | 11 | == Source Code 12 | 13 | https://github.com/openhab/openhab2-addons 14 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_readme_md_directory/dummy.file.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openhab/static-code-analysis/1eac36a5098d1d4fca9d50cb4daab6aad1b696da/custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_readme_md_directory/dummy.file.txt -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/missing_readme_md_directory/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.core.bundles 8 | config 9 | 0.9.0-SNAPSHOT 10 | 11 | 12 | 13 | org.openhab.core.config.dispatch 14 | org.openhab.core.config.dispatch 15 | 16 | 17 | 4.0.0 18 | org.openhab.core.config 19 | org.openhab.core.config.dispatch 20 | 21 | Eclipse SmartHome Configuration Dispatcher 22 | 23 | eclipse-plugin 24 | 25 | 26 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/valid_directory/NOTICE: -------------------------------------------------------------------------------- 1 | This content is produced and maintained by the openHAB project. 2 | 3 | * Project home: https://www.openhab.org 4 | 5 | == Declared Project Licenses 6 | 7 | This program and the accompanying materials are made available under the terms 8 | of the Eclipse Public License 2.0 which is available at 9 | https://www.eclipse.org/legal/epl-2.0/. 10 | 11 | == Source Code 12 | 13 | https://github.com/openhab/openhab2-addons 14 | -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/valid_directory/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openhab/static-code-analysis/1eac36a5098d1d4fca9d50cb4daab6aad1b696da/custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/valid_directory/README.md -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/valid_directory/dummy.file.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openhab/static-code-analysis/1eac36a5098d1d4fca9d50cb4daab6aad1b696da/custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/valid_directory/dummy.file.txt -------------------------------------------------------------------------------- /custom-checks/checkstyle/src/test/resources/checkstyle/requiredFilesCheckTest/valid_directory/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.openhab.core.bundles 8 | config 9 | 0.9.0-SNAPSHOT 10 | 11 | 12 | 13 | org.openhab.core.config.dispatch 14 | org.openhab.core.config.dispatch 15 | 16 | 17 | 4.0.0 18 | org.openhab.core.config 19 | org.openhab.core.config.dispatch 20 | 21 | Eclipse SmartHome Configuration Dispatcher 22 | 23 | eclipse-plugin 24 | 25 | 26 | -------------------------------------------------------------------------------- /custom-checks/findbugs/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | org.openhab.tools.sat.custom-checks 9 | pom 10 | 0.18.0-SNAPSHOT 11 | 12 | 13 | findbugs 14 | 15 | jar 16 | 17 | Findbugs Custom Checks 18 | 19 | 20 | 21 | com.github.spotbugs 22 | spotbugs 23 | ${spotbugs.version} 24 | provided 25 | 26 | 27 | 28 | 29 | 30 | 31 | org.apache.maven.plugins 32 | maven-resources-plugin 33 | ${maven.resources.version} 34 | 35 | 36 | 37 | copy-resources 38 | 39 | prepare-package 40 | 41 | ${project.build.outputDirectory} 42 | 43 | 44 | src/main/resources/metadata/findbugs 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /custom-checks/findbugs/src/main/resources/metadata/findbugs/findbugs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /custom-checks/findbugs/src/main/resources/metadata/findbugs/messages.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | Eclipse SmartHome FindBugs Plugin 8 | 9 | 10 |

This is a class name length detector

]]>
11 | 12 | 13 | The name of the class exceeds the limit 14 | The name of the class exceeds the limit 15 |
Please shorten the name of the class

]]>
16 |
17 | 18 | -------------------------------------------------------------------------------- /custom-checks/pmd/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | org.openhab.tools.sat.custom-checks 9 | pom 10 | 0.18.0-SNAPSHOT 11 | 12 | 13 | pmd 14 | 15 | jar 16 | 17 | PMD Custom Checks 18 | 19 | 20 | 21 | net.sourceforge.pmd 22 | pmd-xml 23 | ${pmd.version} 24 | provided 25 | 26 | 27 | net.sourceforge.pmd 28 | pmd-java 29 | ${pmd.version} 30 | provided 31 | 32 | 33 | net.sourceforge.pmd 34 | pmd-test 35 | ${pmd.version} 36 | test 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /custom-checks/pmd/src/test/java/org/openhab/tools/analysis/pmd/test/ClasspathTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.pmd.test; 14 | 15 | import org.junit.jupiter.api.BeforeEach; 16 | 17 | import net.sourceforge.pmd.test.SimpleAggregatorTst; 18 | 19 | /** 20 | * Test class that includes all custom PMD tests for the .classpath files 21 | * 22 | * @author Svilen Valkanov - Initial contribution 23 | */ 24 | public class ClasspathTest extends SimpleAggregatorTst { 25 | 26 | // How to implement PMD rule test - https://pmd.github.io/pmd-5.4.1/customizing/rule-guidelines.html 27 | @Override 28 | @BeforeEach 29 | public void setUp() { 30 | addRule("src/test/resources/pmd/ruleset/classpath.xml", "AvoidMavenPomderivedInClasspath"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /custom-checks/pmd/src/test/java/org/openhab/tools/analysis/pmd/test/CustomRulesTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.pmd.test; 14 | 15 | import org.junit.jupiter.api.BeforeEach; 16 | 17 | import net.sourceforge.pmd.test.SimpleAggregatorTst; 18 | 19 | /** 20 | * Test class that tests all custom PMD rules. 21 | * 22 | * @author Lyubomir Papazov - Initial contribution 23 | */ 24 | public class CustomRulesTest extends SimpleAggregatorTst { 25 | @Override 26 | @BeforeEach 27 | public void setUp() { 28 | addRule("pmd/ruleset/customrules.xml", "UseSLF4JLoggerRule"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /custom-checks/pmd/src/test/java/org/openhab/tools/analysis/pmd/test/PomTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.pmd.test; 14 | 15 | import org.junit.jupiter.api.BeforeEach; 16 | 17 | import net.sourceforge.pmd.test.SimpleAggregatorTst; 18 | 19 | /** 20 | * Test class that includes all custom PMD tests for the pom.xml files 21 | * 22 | * @author Svilen Valkanov - Initial contribution 23 | */ 24 | public class PomTest extends SimpleAggregatorTst { 25 | 26 | @Override 27 | @BeforeEach 28 | public void setUp() { 29 | addRule("src/test/resources/pmd/ruleset/pom.xml", "AvoidOverridingParentPomConfiguration"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /custom-checks/pmd/src/test/resources/org/openhab/tools/analysis/pmd/test/xml/AvoidMavenPomderivedInClasspath.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | Maven pomderived in .classpath 7 | 1 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | ]]> 24 | 25 | 26 | -------------------------------------------------------------------------------- /custom-checks/pmd/src/test/resources/org/openhab/tools/analysis/pmd/test/xml/AvoidOverridingParentPomConfiguration.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | Override parent pom configuration 7 | 1 8 | 12 | 13 | 14 | 15 | ${tycho-groupid} 16 | target-platform-configuration 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | ]]> 26 | 27 | 28 | -------------------------------------------------------------------------------- /custom-checks/pmd/src/test/resources/pmd/ruleset/classpath.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | Rule set that contains custom defined rules regarding the .classpath files 6 | 7 | 8 | 10 | 11 | Eclipse is adding the attribute "maven.pomderived" automatically to the classpath, when converting a 12 | project to Maven project, but most of the time it is not required 13 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | ]]> 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /custom-checks/pmd/src/test/resources/pmd/ruleset/customrules.xml: -------------------------------------------------------------------------------- 1 | 3 | Rule set that contains custom defined rules regarding the .classpath files 4 | 5 | 6 | -------------------------------------------------------------------------------- /custom-checks/pmd/src/test/resources/pmd/ruleset/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | Rule set that contains custom defined rules regarding the pom.xml files 6 | 7 | 9 | 10 | Avoid overriding configuration inherited by parent pom 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 | 22 | 23 | 26 | ... 27 | 28 | ... 29 | 30 | ]]> 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /custom-checks/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | org.openhab.tools.sat 9 | pom 10 | 0.18.0-SNAPSHOT 11 | 12 | 13 | org.openhab.tools.sat.custom-checks 14 | pom 15 | 16 | pom 17 | 18 | Static Code Analysis Custom Checks 19 | 20 | 21 | checkstyle 22 | pmd 23 | findbugs 24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/images/individual-report.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openhab/static-code-analysis/1eac36a5098d1d4fca9d50cb4daab6aad1b696da/docs/images/individual-report.PNG -------------------------------------------------------------------------------- /docs/images/summary-report.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openhab/static-code-analysis/1eac36a5098d1d4fca9d50cb4daab6aad1b696da/docs/images/summary-report.PNG -------------------------------------------------------------------------------- /licenses/epl-2.0/header.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-${year} Contributors to the openHAB project 2 | 3 | See the NOTICE file(s) distributed with this work for additional 4 | information. 5 | 6 | This program and the accompanying materials are made available under the 7 | terms of the Eclipse Public License 2.0 which is available at 8 | http://www.eclipse.org/legal/epl-2.0 9 | 10 | SPDX-License-Identifier: EPL-2.0 11 | -------------------------------------------------------------------------------- /licenses/epl-2.0/xml-header-style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ]]> 7 | $]]> 8 | 9 | (\s|\t)*$]]> 10 | true 11 | true 12 | 13 | 14 | -------------------------------------------------------------------------------- /sat-extension/src/main/java/org/openhab/tools/analysis/report/SummaryReportLifecycleParticipant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.report; 14 | 15 | import org.apache.maven.AbstractMavenLifecycleParticipant; 16 | import org.apache.maven.MavenExecutionException; 17 | import org.apache.maven.execution.MavenSession; 18 | import org.codehaus.plexus.component.annotations.Component; 19 | import org.codehaus.plexus.component.annotations.Requirement; 20 | 21 | /** 22 | * Handles {@link MavenSession} events so the SAT extension can generate HTML report summaries. 23 | * 24 | * @author Wouter Born - Initial contribution 25 | */ 26 | @Component(role = AbstractMavenLifecycleParticipant.class) 27 | public class SummaryReportLifecycleParticipant extends AbstractMavenLifecycleParticipant { 28 | 29 | @Requirement 30 | private SummaryReportExecutionListener summaryReportExecutionListener; 31 | 32 | @Requirement 33 | private SummaryReportHtmlGenerator summaryReportHtmlGenerator; 34 | 35 | @Override 36 | public void afterProjectsRead(MavenSession session) throws MavenExecutionException { 37 | // The context class loader of the current thread needs to be used with the 38 | // SummaryReportHtmlGenerator or it will not find the XSLT files on the class path 39 | summaryReportHtmlGenerator.initialize(); 40 | summaryReportExecutionListener.chainListener(session); 41 | } 42 | 43 | @Override 44 | public void afterSessionEnd(MavenSession session) throws MavenExecutionException { 45 | summaryReportExecutionListener.generateFinalSummaryReports(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /sat-plugin/src/main/java/org/openhab/tools/analysis/report/SummaryHtmlGeneration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.report; 14 | 15 | /** 16 | * Enumerates the HTML summary generation plugin configuration parameters. 17 | * 18 | * @author Wouter Born - Initial contribution 19 | */ 20 | enum SummaryHtmlGeneration { 21 | CONTINUOUS, 22 | PERIODIC, 23 | ONCE, 24 | NEVER 25 | } 26 | -------------------------------------------------------------------------------- /sat-plugin/src/main/java/org/openhab/tools/analysis/tools/internal/SpotBugsVisitors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2025 Contributors to the openHAB project 3 | * 4 | * See the NOTICE file(s) distributed with this work for additional 5 | * information. 6 | * 7 | * This program and the accompanying materials are made available under the 8 | * terms of the Eclipse Public License 2.0 which is available at 9 | * http://www.eclipse.org/legal/epl-2.0 10 | * 11 | * SPDX-License-Identifier: EPL-2.0 12 | */ 13 | package org.openhab.tools.analysis.tools.internal; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | import javax.xml.bind.annotation.XmlElement; 19 | import javax.xml.bind.annotation.XmlRootElement; 20 | 21 | import org.apache.commons.lang3.StringUtils; 22 | 23 | /** 24 | * A JAXB model of the SpotBugs visitors XML file 25 | * 26 | * @author Svilen Valkanov - Initial contribution 27 | */ 28 | @XmlRootElement(name = "visitors") 29 | public class SpotBugsVisitors { 30 | 31 | @XmlElement 32 | List visitor = new ArrayList<>(); 33 | 34 | @Override 35 | public String toString() { 36 | return StringUtils.join(visitor, ","); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /sat-plugin/src/main/resources/configuration/checkstyle.properties: -------------------------------------------------------------------------------- 1 | checkstyle.output.file=${project.build.directory}/code-analysis/checkstyle-result.xml 2 | checkstyle.console=true 3 | checkstyle.includes=src/main/java/**,src/main/resources/OH-INF/**,src/main/feature/feature.xml,src/test/java/**,.classpath,pom.xml,README.md 4 | checkstyle.includeResources=false 5 | checkstyle.includeTestResources=false 6 | linkXRef=false 7 | -------------------------------------------------------------------------------- /sat-plugin/src/main/resources/configuration/pmd.properties: -------------------------------------------------------------------------------- 1 | pmd.custom.targetDirectory=${project.build.directory}/code-analysis 2 | pmd.custom.compileSourceRoots=${project.build.directory}/../src/main/java,${project.build.directory}/../src/test/java 3 | linkXRef=false 4 | -------------------------------------------------------------------------------- /sat-plugin/src/main/resources/configuration/spotbugs.properties: -------------------------------------------------------------------------------- 1 | spotbugs.relaxed=true 2 | spotbugs.debug=false 3 | spotbugs.threshold=High 4 | spotbugs.effort=Min 5 | spotbugs.xmlOutput=true 6 | spotbugs.failOnError=false 7 | spotbugs.report.dir=${project.build.directory}/code-analysis 8 | spotbugs.fork=true 9 | outputEncoding=UTF-8 10 | spotbugs.onlyAnalyze=org.openhab.-,org.openhab.core.- 11 | spotbugs.nested=false 12 | -------------------------------------------------------------------------------- /sat-plugin/src/main/resources/report/summary.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Summary Report 7 | 28 | 29 | 30 |

Summary report ($time)

31 |

Individual reports

32 | 33 | 34 | 35 | 36 | 37 |
Bundle
38 | 39 | 40 | -------------------------------------------------------------------------------- /sat-plugin/src/main/resources/rulesets/pmd/customrules.xml: -------------------------------------------------------------------------------- 1 | 4 | Rule set that contains custom rules created for checking all bundles 5 | 6 | 3 7 | 8 | 9 | -------------------------------------------------------------------------------- /sat-plugin/src/main/resources/rulesets/pmd/suppressions.properties: -------------------------------------------------------------------------------- 1 | #Currently there are no default suppressions 2 | #Please check here how to add suppressions https://maven.apache.org/plugins/maven-pmd-plugin/examples/violation-exclusions.html -------------------------------------------------------------------------------- /sat-plugin/src/main/resources/rulesets/spotbugs/exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /sat-plugin/src/main/resources/rulesets/spotbugs/include.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /sat-plugin/src/test/resources/report/checkstyle-result.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /sat-plugin/src/test/resources/report/pmd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | An operation on an Immutable object (String, BigDecimal or BigInteger) won't change the object itself 10 | 11 | 12 | 13 | 14 | Do not use if statements that are always true or always false 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tools/static-code-analysis/checkstyle/ruleset.properties: -------------------------------------------------------------------------------- 1 | checkstyle.forbiddenPackageUsageCheck.forbiddenPackages=com.google.common,gnu.io,javax.comm,org.apache.commons,org.joda.time,org.junit.Assert,org.junit.Test,si.uom,tech.units 2 | checkstyle.forbiddenPackageUsageCheck.exceptions= 3 | checkstyle.headerCheck.content=^/\\*$\\n^ \\* Copyright \\(c\\) {0}-{1} Contributors to the openHAB project$\\n^ \\*$\\n^ \\* See the NOTICE file\\(s\\) distributed with this work for additional$\\n^ \\* information.$\\n^ \\*$\\n^ \\* This program and the accompanying materials are made available under the$\\n^ \\* terms of the Eclipse Public License 2\\.0 which is available at$\\n^ \\* http://www.eclipse.org/legal/epl\\-2\\.0$\\n^ \\*$\\n^ \\* SPDX-License-Identifier: EPL-2.0$ 4 | checkstyle.headerCheck.values=2010,2025 5 | checkstyle.requiredFilesCheck.extensions=xml,md 6 | checkstyle.requiredFilesCheck.files=pom.xml 7 | 8 | -------------------------------------------------------------------------------- /tools/static-code-analysis/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /tools/static-code-analysis/pmd/suppressions.properties: -------------------------------------------------------------------------------- 1 | org.openhab.tools.analysis.checkstyle.test.LoggerRule=UseSLF4J 2 | --------------------------------------------------------------------------------