Skip to content

New rule to check if @Preview (Jetpack Compose) functions end with 'Preview' suffix and are also private. Part 1 #5557

New rule to check if @Preview (Jetpack Compose) functions end with 'Preview' suffix and are also private. Part 1

New rule to check if @Preview (Jetpack Compose) functions end with 'Preview' suffix and are also private. Part 1 #5557

This check has been archived and is scheduled for deletion. Learn more about checks retention
GitHub Actions / JUnit Tests (macOS, EnricoMi/publish-unit-test-result-action@v2) failed Aug 31, 2023 in 0s

3 fail, 36 skipped, 1 334 pass in 6m 14s

   163 files     163 suites   6m 14s ⏱️
1 373 tests 1 334 ✔️ 36 💤 3
2 752 runs  2 713 ✔️ 36 💤 3

Results for commit f40186e.

Annotations

Check warning on line 0 in com.saveourtool.diktat.ruleset.utils.RulesConfigYamlTest

See this annotation in the file changed.

@github-actions github-actions / JUnit Tests (macOS, EnricoMi/publish-unit-test-result-action@v2)

read rules config yml() (com.saveourtool.diktat.ruleset.utils.RulesConfigYamlTest) failed

diktat-rules/build/test-results/test/TEST-com.saveourtool.diktat.ruleset.utils.RulesConfigYamlTest.xml [took 0s]
Raw output
org.opentest4j.AssertionFailedError:                    Cannot find warning PREVIEW_ANNOTATION in diKTat/diktat-rules/src/main/resources/diktat-analysis.yml.
                   You can fix it by adding the following code below to diKTat/diktat-rules/src/main/resources/diktat-analysis.yml:
                   name: "PREVIEW_ANNOTATION"
enabled: true
configuration: {}
ignoreAnnotated: [] ==> expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:42)
	at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:187)
	at com.saveourtool.diktat.ruleset.utils.RulesConfigYamlTest.compareRulesAndConfig(RulesConfigYamlTest.kt:93)
	at com.saveourtool.diktat.ruleset.utils.RulesConfigYamlTest.compareRulesAndConfig$default(RulesConfigYamlTest.kt:80)
	at com.saveourtool.diktat.ruleset.utils.RulesConfigYamlTest.read rules config yml(RulesConfigYamlTest.kt:35)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)

Check warning on line 0 in com.saveourtool.diktat.ruleset.utils.AvailableRulesDocTest

See this annotation in the file changed.

@github-actions github-actions / JUnit Tests (macOS, EnricoMi/publish-unit-test-result-action@v2)

read rules from documentation() (com.saveourtool.diktat.ruleset.utils.AvailableRulesDocTest) failed

diktat-rules/build/test-results/test/TEST-com.saveourtool.diktat.ruleset.utils.AvailableRulesDocTest.xml [took 0s]
Raw output
org.opentest4j.AssertionFailedError: 
                    Cannot find warning PREVIEW_ANNOTATION in ../info/available-rules.md.
                    You can fix it by adding the following description below with more info to ../info/available-rules.md:
                    add | | | PREVIEW_ANNOTATION|  |  |  | | to ../info/available-rules.md
                 ==> expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:42)
	at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:187)
	at com.saveourtool.diktat.ruleset.utils.AvailableRulesDocTest.read rules from documentation(AvailableRulesDocTest.kt:37)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)

Check warning on line 0 in com.saveourtool.diktat.util.DiktatRuleSetFactoryImplTest

See this annotation in the file changed.

@github-actions github-actions / JUnit Tests (macOS, EnricoMi/publish-unit-test-result-action@v2)

check DiktatRuleSetFactoryImpl contain all rules() (com.saveourtool.diktat.util.DiktatRuleSetFactoryImplTest) failed

diktat-rules/build/test-results/test/TEST-com.saveourtool.diktat.util.DiktatRuleSetFactoryImplTest.xml [took 0s]
Raw output
org.opentest4j.AssertionFailedError: 
Expecting actual:
  ["AbstractClassesRule",
    "AccurateCalculationsRule",
    "AnnotationNewLineRule",
    "AsyncAndSyncRule",
    "AvoidEmptyPrimaryConstructor",
    "AvoidNestedFunctionsRule",
    "AvoidUtilityClass",
    "BlankLinesRule",
    "BlockStructureBraces",
    "BooleanExpressionsRule",
    "BracesInConditionalsAndLoopsRule",
    "CheckInverseMethodRule",
    "ClassLikeStructuresOrderRule",
    "CollapseIfStatementsRule",
    "CommentsFormatting",
    "CommentsRule",
    "CompactInitialization",
    "ConsecutiveSpacesRule",
    "CustomGetterSetterRule",
    "CustomLabel",
    "DataClassesRule",
    "DebugPrintRule",
    "EmptyBlock",
    "EnumsSeparated",
    "ExtensionFunctionsInFileRule",
    "ExtensionFunctionsSameNameRule",
    "FileNaming",
    "FileSize",
    "FileStructureRule",
    "FunctionArgumentsSize",
    "FunctionLength",
    "HeaderCommentRule",
    "IdentifierNaming",
    "ImmutableValNoVarRule",
    "ImplicitBackingPropertyRule",
    "IndentationRule",
    "InlineClassesRule",
    "KdocComments",
    "KdocFormatting",
    "KdocMethods",
    "LambdaLengthRule",
    "LambdaParameterOrder",
    "LineLength",
    "LocalVariablesRule",
    "LongNumericalValuesSeparatedRule",
    "MagicNumberRule",
    "MultipleModifiersSequence",
    "NestedFunctionBlock",
    "NewlinesRule",
    "NullChecksRule",
    "NullableTypeRule",
    "OverloadingArgumentsFunction",
    "PackageNaming",
    "ParameterNameInOuterLambdaRule",
    "PropertyAccessorFields",
    "RangeConventionalRule",
    "RunInScript",
    "SingleConstructorRule",
    "SingleInitRule",
    "SingleLineStatementsRule",
    "SmartCastRule",
    "SortRule",
    "StatelessClassesRule",
    "StringConcatenationRule",
    "StringTemplateFormatRule",
    "TopLevelOrderRule",
    "TrailingCommaRule",
    "TrivialPropertyAccessors",
    "TypeAliasRule",
    "UseLastIndex",
    "UselessSupertype",
    "VariableGenericTypeDeclarationRule",
    "WhenMustHaveElseRule",
    "WhiteSpaceRule"]
to contain exactly (and in same order):
  ["AbstractClassesRule",
    "AccurateCalculationsRule",
    "AnnotationNewLineRule",
    "AsyncAndSyncRule",
    "AvoidEmptyPrimaryConstructor",
    "AvoidNestedFunctionsRule",
    "AvoidUtilityClass",
    "BlankLinesRule",
    "BlockStructureBraces",
    "BooleanExpressionsRule",
    "BracesInConditionalsAndLoopsRule",
    "CheckInverseMethodRule",
    "ClassLikeStructuresOrderRule",
    "CollapseIfStatementsRule",
    "CommentsFormatting",
    "CommentsRule",
    "CompactInitialization",
    "ConsecutiveSpacesRule",
    "CustomGetterSetterRule",
    "CustomLabel",
    "DataClassesRule",
    "DebugPrintRule",
    "EmptyBlock",
    "EnumsSeparated",
    "ExtensionFunctionsInFileRule",
    "ExtensionFunctionsSameNameRule",
    "FileNaming",
    "FileSize",
    "FileStructureRule",
    "FunctionArgumentsSize",
    "FunctionLength",
    "HeaderCommentRule",
    "IdentifierNaming",
    "ImmutableValNoVarRule",
    "ImplicitBackingPropertyRule",
    "IndentationRule",
    "InlineClassesRule",
    "KdocComments",
    "KdocFormatting",
    "KdocMethods",
    "LambdaLengthRule",
    "LambdaParameterOrder",
    "LineLength",
    "LocalVariablesRule",
    "LongNumericalValuesSeparatedRule",
    "MagicNumberRule",
    "MultipleModifiersSequence",
    "NestedFunctionBlock",
    "NewlinesRule",
    "NullChecksRule",
    "NullableTypeRule",
    "OverloadingArgumentsFunction",
    "PackageNaming",
    "ParameterNameInOuterLambdaRule",
    "PreviewAnnotationRule",
    "PropertyAccessorFields",
    "RangeConventionalRule",
    "RunInScript",
    "SingleConstructorRule",
    "SingleInitRule",
    "SingleLineStatementsRule",
    "SmartCastRule",
    "SortRule",
    "StatelessClassesRule",
    "StringConcatenationRule",
    "StringTemplateFormatRule",
    "TopLevelOrderRule",
    "TrailingCommaRule",
    "TrivialPropertyAccessors",
    "TypeAliasRule",
    "UseLastIndex",
    "UselessSupertype",
    "VariableGenericTypeDeclarationRule",
    "WhenMustHaveElseRule",
    "WhiteSpaceRule"]
but could not find the following elements:
  ["PreviewAnnotationRule"]

	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at com.saveourtool.diktat.util.DiktatRuleSetFactoryImplTest.check DiktatRuleSetFactoryImpl contain all rules(DiktatRuleSetFactoryImplTest.kt:47)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)