diff --git a/build.gradle.kts b/build.gradle.kts index 49a93e96..a9fa539d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -103,7 +103,7 @@ allprojects { endWithNewline() licenseHeaderFile( rootProject.file("spotless/spotless.kt"), - "(import|plugins|buildscript|dependencies|pluginManagement)" + "(import|plugins|buildscript|dependencies|pluginManagement)", ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/ComposableFunctionNamingDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/ComposableFunctionNamingDetector.kt index 92e2ebd2..e35decd2 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/ComposableFunctionNamingDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/ComposableFunctionNamingDetector.kt @@ -30,7 +30,7 @@ constructor( "allowed-composable-function-names", "A comma-separated list of regexes of allowed composable function names", null, - "This property should define comma-separated list of regexes of allowed composable function names." + "This property should define comma-separated list of regexes of allowed composable function names.", ) private val ISSUE_UPPERCASE = @@ -46,7 +46,7 @@ constructor( category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) .setOptions(listOf(ALLOWED_COMPOSABLE_FUNCTION_NAMES)) @@ -63,7 +63,7 @@ constructor( category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) .setOptions(listOf(ALLOWED_COMPOSABLE_FUNCTION_NAMES)) @@ -88,7 +88,7 @@ constructor( ISSUE_UPPERCASE, function, context.getNameLocation(function), - ISSUE_UPPERCASE.getExplanation(TextFormat.TEXT) + ISSUE_UPPERCASE.getExplanation(TextFormat.TEXT), ) } } else { @@ -98,7 +98,7 @@ constructor( ISSUE_LOWERCASE, function, context.getNameLocation(function), - ISSUE_LOWERCASE.getExplanation(TextFormat.TEXT) + ISSUE_LOWERCASE.getExplanation(TextFormat.TEXT), ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/CompositionLocalUsageDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/CompositionLocalUsageDetector.kt index 9d18aad7..4ffd54e1 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/CompositionLocalUsageDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/CompositionLocalUsageDetector.kt @@ -29,7 +29,7 @@ class CompositionLocalUsageDetector : Detector(), SourceCodeScanner { "allowed-composition-locals", "A comma-separated list of CompositionLocals that should be allowed", null, - "This property should define a comma-separated list of `CompositionLocal`s that should be allowed." + "This property should define a comma-separated list of `CompositionLocal`s that should be allowed.", ) val ISSUE = @@ -44,7 +44,7 @@ class CompositionLocalUsageDetector : Detector(), SourceCodeScanner { category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.WARNING, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) .setOptions(listOf(ALLOW_LIST)) @@ -78,7 +78,7 @@ class CompositionLocalUsageDetector : Detector(), SourceCodeScanner { ISSUE, node, context.getLocation(node), - ISSUE.getExplanation(TextFormat.TEXT) + ISSUE.getExplanation(TextFormat.TEXT), ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/ContentEmitterLintOption.kt b/compose-lint-checks/src/main/java/slack/lint/compose/ContentEmitterLintOption.kt index b20814a6..dc85af22 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/ContentEmitterLintOption.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/ContentEmitterLintOption.kt @@ -17,7 +17,7 @@ class ContentEmitterLintOption(option: StringOption) : StringSetLintOption(optio "content-emitters", "A comma-separated list of known content-emitting composables", null, - "This property should define a comma-separated list of known content-emitting composables." + "This property should define a comma-separated list of known content-emitting composables.", ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/ContentEmitterReturningValuesDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/ContentEmitterReturningValuesDetector.kt index e3ea1e19..83de2c32 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/ContentEmitterReturningValuesDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/ContentEmitterReturningValuesDetector.kt @@ -50,7 +50,7 @@ constructor( category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) .setOptions(listOf(CONTENT_EMITTER_OPTION)) } @@ -119,7 +119,7 @@ constructor( ISSUE, composable, context.getLocation(composable), - ISSUE.getExplanation(TextFormat.TEXT) + ISSUE.getExplanation(TextFormat.TEXT), ) } @@ -157,7 +157,7 @@ constructor( ISSUE, composable, context.getLocation(composable), - ISSUE.getExplanation(TextFormat.TEXT) + ISSUE.getExplanation(TextFormat.TEXT), ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/M2ApiDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/M2ApiDetector.kt index 22be5768..2cf7edae 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/M2ApiDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/M2ApiDetector.kt @@ -34,7 +34,7 @@ constructor(private val allowList: StringSetLintOption = StringSetLintOption(ALL "allowed-m2-apis", "A comma-separated list of APIs in androidx.compose.material that should be allowed.", null, - "This property should define a comma-separated list of APIs in androidx.compose.material that should be allowed." + "This property should define a comma-separated list of APIs in androidx.compose.material that should be allowed.", ) val ISSUE = @@ -49,7 +49,7 @@ constructor(private val allowList: StringSetLintOption = StringSetLintOption(ALL category = CORRECTNESS, priority = NORMAL, severity = ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) .setOptions(listOf(ALLOW_LIST)) .setEnabledByDefault(false) diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/ModifierComposableDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/ModifierComposableDetector.kt index bcf1491f..fddbfe43 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/ModifierComposableDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/ModifierComposableDetector.kt @@ -30,7 +30,7 @@ class ModifierComposableDetector : ComposableFunctionDetector(), SourceCodeScann category = Category.CORRECTNESS, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/ModifierComposedDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/ModifierComposedDetector.kt index 531583d6..77025fa4 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/ModifierComposedDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/ModifierComposedDetector.kt @@ -34,14 +34,11 @@ class ModifierComposedDetector : Detector(), SourceCodeScanner { category = Category.CORRECTNESS, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) } - override fun getApplicableUastTypes() = - listOf>( - UCallExpression::class.java, - ) + override fun getApplicableUastTypes() = listOf>(UCallExpression::class.java) override fun createUastHandler(context: JavaContext): UElementHandler? { if (!isKotlin(context.uastFile?.lang)) return null diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/ModifierMissingDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/ModifierMissingDetector.kt index fb984785..04f5180d 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/ModifierMissingDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/ModifierMissingDetector.kt @@ -39,7 +39,7 @@ constructor( description = "Visibility threshold to check for Modifiers", defaultValue = "only_public", explanation = - "You can control the visibility of which composables to check for Modifiers. Possible values are: `only_public` (default), `public_and_internal` and `all`" + "You can control the visibility of which composables to check for Modifiers. Possible values are: `only_public` (default), `public_and_internal` and `all`", ) val ISSUE = @@ -54,7 +54,7 @@ constructor( category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) .setOptions(listOf(CONTENT_EMITTER_OPTION, VISIBILITY_THRESHOLD)) } @@ -97,7 +97,7 @@ constructor( ISSUE, function, context.getNameLocation(function), - ISSUE.getExplanation(TextFormat.TEXT) + ISSUE.getExplanation(TextFormat.TEXT), ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/ModifierReusedDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/ModifierReusedDetector.kt index 6dbc3699..4376f836 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/ModifierReusedDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/ModifierReusedDetector.kt @@ -51,7 +51,7 @@ constructor( category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) .setOptions(listOf(CONTENT_EMITTER_OPTION)) } @@ -108,7 +108,7 @@ constructor( ISSUE, callExpression, context.getLocation(callExpression), - ISSUE.getExplanation(TextFormat.TEXT) + ISSUE.getExplanation(TextFormat.TEXT), ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/ModifierWithoutDefaultDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/ModifierWithoutDefaultDetector.kt index d5f4ed21..21ab87b8 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/ModifierWithoutDefaultDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/ModifierWithoutDefaultDetector.kt @@ -37,7 +37,7 @@ class ModifierWithoutDefaultDetector : ComposableFunctionDetector(), SourceCodeS category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) } @@ -74,7 +74,7 @@ class ModifierWithoutDefaultDetector : ComposableFunctionDetector(), SourceCodeS .text(currentText) .with("$currentText = Modifier") .autoFix() - .build() + .build(), ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/MultipleContentEmittersDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/MultipleContentEmittersDetector.kt index f930fb77..8c2047a0 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/MultipleContentEmittersDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/MultipleContentEmittersDetector.kt @@ -52,7 +52,7 @@ constructor( category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) .setOptions(listOf(CONTENT_EMITTER_OPTION)) } @@ -154,7 +154,7 @@ constructor( ISSUE, composable, context.getLocation(composable), - ISSUE.getExplanation(TextFormat.TEXT) + ISSUE.getExplanation(TextFormat.TEXT), ) } @@ -193,7 +193,7 @@ constructor( ISSUE, composable, context.getLocation(composable), - ISSUE.getExplanation(TextFormat.TEXT) + ISSUE.getExplanation(TextFormat.TEXT), ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/MutableParametersDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/MutableParametersDetector.kt index 34588c11..f093d9fe 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/MutableParametersDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/MutableParametersDetector.kt @@ -30,7 +30,7 @@ class MutableParametersDetector : ComposableFunctionDetector(), SourceCodeScanne category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) } @@ -42,7 +42,7 @@ class MutableParametersDetector : ComposableFunctionDetector(), SourceCodeScanne ISSUE, parameter.typeReference, context.getLocation(parameter.typeReference), - ISSUE.getExplanation(TextFormat.TEXT) + ISSUE.getExplanation(TextFormat.TEXT), ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/ParameterOrderDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/ParameterOrderDetector.kt index 206e0e9b..1551e318 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/ParameterOrderDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/ParameterOrderDetector.kt @@ -27,7 +27,7 @@ class ParameterOrderDetector : ComposableFunctionDetector(), SourceCodeScanner { fun createErrorMessage(currentOrder: List, properOrder: List): String = createErrorMessage( currentOrder.joinToString { it.text }, - properOrder.joinToString { it.text } + properOrder.joinToString { it.text }, ) private fun createErrorMessage(currentOrder: String, properOrder: String): String = @@ -46,7 +46,7 @@ class ParameterOrderDetector : ComposableFunctionDetector(), SourceCodeScanner { category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) } @@ -100,7 +100,7 @@ class ParameterOrderDetector : ComposableFunctionDetector(), SourceCodeScanner { .range(errorLocation) .with(properOrder.joinToString(prefix = "(", postfix = ")") { it.text }) .reformat(true) - .build() + .build(), ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/PreviewNamingDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/PreviewNamingDetector.kt index 70fb8b67..192021f2 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/PreviewNamingDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/PreviewNamingDetector.kt @@ -37,7 +37,7 @@ class PreviewNamingDetector : Detector(), SourceCodeScanner { category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) } @@ -69,14 +69,7 @@ class PreviewNamingDetector : Detector(), SourceCodeScanner { } else { null } - message?.let { - context.report( - ISSUE, - clazz, - context.getLocation(clazz), - it, - ) - } + message?.let { context.report(ISSUE, clazz, context.getLocation(clazz), it) } } } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/PreviewPublicDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/PreviewPublicDetector.kt index 662f7358..e4434c73 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/PreviewPublicDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/PreviewPublicDetector.kt @@ -36,7 +36,7 @@ constructor( "preview-public-only-if-params", "If set to true, this check will only enforce on previews that have no PreviewParameters", true, - "If set to true, this check will only enforce on previews that have no PreviewParameters" + "If set to true, this check will only enforce on previews that have no PreviewParameters", ) val ISSUE = @@ -51,7 +51,7 @@ constructor( category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) .setOptions(listOf(PREVIEW_PUBLIC_ONLY_IF_PARAMS_OPTION)) } @@ -107,7 +107,7 @@ constructor( function, context.getLocation(function), ISSUE.getExplanation(TextFormat.TEXT), - fix + fix, ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/RememberMissingDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/RememberMissingDetector.kt index 5464611f..329adc58 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/RememberMissingDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/RememberMissingDetector.kt @@ -39,7 +39,7 @@ class RememberMissingDetector : ComposableFunctionDetector(), SourceCodeScanner category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) } @@ -60,7 +60,7 @@ class RememberMissingDetector : ComposableFunctionDetector(), SourceCodeScanner ISSUE, callExpression, context.getLocation(callExpression), - MutableStateOfNotRemembered + MutableStateOfNotRemembered, ) } "derivedStateOf" -> { @@ -68,7 +68,7 @@ class RememberMissingDetector : ComposableFunctionDetector(), SourceCodeScanner ISSUE, callExpression, context.getLocation(callExpression), - DerivedStateOfNotRemembered + DerivedStateOfNotRemembered, ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/UnstableCollectionsDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/UnstableCollectionsDetector.kt index 870b093a..1be4de6f 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/UnstableCollectionsDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/UnstableCollectionsDetector.kt @@ -41,7 +41,7 @@ class UnstableCollectionsDetector : ComposableFunctionDetector(), SourceCodeScan category = Category.PRODUCTIVITY, priority = Priorities.NORMAL, severity = Severity.WARNING, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) } @@ -53,15 +53,10 @@ class UnstableCollectionsDetector : ComposableFunctionDetector(), SourceCodeScan createErrorMessage( type = type, rawType = type.replace(DiamondRegex, ""), - variable = variableName + variable = variableName, ) val targetToReport = param.typeReference ?: param - context.report( - ISSUE, - targetToReport, - context.getLocation(targetToReport), - message, - ) + context.report(ISSUE, targetToReport, context.getLocation(targetToReport), message) } } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/ViewModelForwardingDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/ViewModelForwardingDetector.kt index 17481bc5..d191ab09 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/ViewModelForwardingDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/ViewModelForwardingDetector.kt @@ -39,7 +39,7 @@ class ViewModelForwardingDetector : ComposableFunctionDetector(), SourceCodeScan category = Category.CORRECTNESS, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) } @@ -89,7 +89,7 @@ class ViewModelForwardingDetector : ComposableFunctionDetector(), SourceCodeScan ISSUE, callExpression, context.getLocation(callExpression), - ISSUE.getExplanation(TextFormat.TEXT) + ISSUE.getExplanation(TextFormat.TEXT), ) } } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/ViewModelInjectionDetector.kt b/compose-lint-checks/src/main/java/slack/lint/compose/ViewModelInjectionDetector.kt index 8e339fe4..42e79dae 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/ViewModelInjectionDetector.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/ViewModelInjectionDetector.kt @@ -34,7 +34,7 @@ constructor(private val userFactories: StringSetLintOption = StringSetLintOption "viewmodel-factories", "A comma-separated list of viewModel factories.", null, - "This property should define comma-separated list of allowed viewModel factory function names." + "This property should define comma-separated list of allowed viewModel factory function names.", ) private fun errorMessage(factoryName: String): String = @@ -53,7 +53,7 @@ constructor(private val userFactories: StringSetLintOption = StringSetLintOption category = Category.CORRECTNESS, priority = Priorities.NORMAL, severity = Severity.ERROR, - implementation = sourceImplementation() + implementation = sourceImplementation(), ) .setOptions(listOf(USER_FACTORIES)) diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/util/Composables.kt b/compose-lint-checks/src/main/java/slack/lint/compose/util/Composables.kt index 12ad43eb..6a24b05a 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/util/Composables.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/util/Composables.kt @@ -135,7 +135,7 @@ private val ComposableEmittersList by lazy { "TopAppBarSurface", "VerticalPager", "VerticalPagerIndicator", - "WebView" + "WebView", ) } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/util/KotlinUtils.kt b/compose-lint-checks/src/main/java/slack/lint/compose/util/KotlinUtils.kt index 125ce481..7101b4bf 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/util/KotlinUtils.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/util/KotlinUtils.kt @@ -23,7 +23,7 @@ fun String.toCamelCase() = original.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() } - } + }, ) fun String.toSnakeCase() = replace(humps, "_").lowercase(Locale.getDefault()) diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/util/KtCallableDeclarations.kt b/compose-lint-checks/src/main/java/slack/lint/compose/util/KtCallableDeclarations.kt index 090f3203..9216b101 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/util/KtCallableDeclarations.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/util/KtCallableDeclarations.kt @@ -69,7 +69,7 @@ val KnownMutableCommonTypesSimpleNames = "ReplaySubject", "PublishRelay", "BehaviorRelay", - "ReplayRelay" + "ReplayRelay", ) fun UParameter.isTypeUnstableCollection(evaluator: JavaEvaluator): Boolean { diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/util/KtFunctions.kt b/compose-lint-checks/src/main/java/slack/lint/compose/util/KtFunctions.kt index 4aaeebb6..1195147b 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/util/KtFunctions.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/util/KtFunctions.kt @@ -4,7 +4,7 @@ package slack.lint.compose.util import com.android.tools.lint.client.api.JavaEvaluator -import com.intellij.psi.PsiType +import com.intellij.psi.PsiTypes import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtClass import org.jetbrains.kotlin.psi.KtClassBody @@ -14,8 +14,7 @@ import org.jetbrains.uast.UMethod fun UMethod.returnsUnitOrVoid(evaluator: JavaEvaluator): Boolean { return returnType?.let { - // TODO switch to PsiTypes.voidType() in newer lint versions - it == PsiType.VOID || evaluator.getTypeClass(it)?.qualifiedName == "kotlin.Unit" + it == PsiTypes.voidType() || evaluator.getTypeClass(it)?.qualifiedName == "kotlin.Unit" } ?: false } diff --git a/compose-lint-checks/src/main/java/slack/lint/compose/util/LintUtils.kt b/compose-lint-checks/src/main/java/slack/lint/compose/util/LintUtils.kt index de50b9a2..902f42b4 100644 --- a/compose-lint-checks/src/main/java/slack/lint/compose/util/LintUtils.kt +++ b/compose-lint-checks/src/main/java/slack/lint/compose/util/LintUtils.kt @@ -26,7 +26,7 @@ internal inline fun sourceImplementation( T::class.java, EnumSet.of(Scope.JAVA_FILE, Scope.TEST_SOURCES), EnumSet.of(Scope.JAVA_FILE), - EnumSet.of(Scope.TEST_SOURCES) + EnumSet.of(Scope.TEST_SOURCES), ) } else { Implementation(T::class.java, EnumSet.of(Scope.JAVA_FILE)) @@ -36,7 +36,7 @@ internal inline fun sourceImplementation( /** Loads a [StringOption] as a [delimiter]-delimited [Set] of strings. */ internal fun StringOption.loadAsSet( configuration: Configuration, - delimiter: String = "," + delimiter: String = ",", ): Set { return getValue(configuration) ?.splitToSequence(delimiter) diff --git a/compose-lint-checks/src/test/java/slack/lint/compose/BaseComposeLintTest.kt b/compose-lint-checks/src/test/java/slack/lint/compose/BaseComposeLintTest.kt index 9de67913..5131c953 100644 --- a/compose-lint-checks/src/test/java/slack/lint/compose/BaseComposeLintTest.kt +++ b/compose-lint-checks/src/test/java/slack/lint/compose/BaseComposeLintTest.kt @@ -73,7 +73,7 @@ abstract class BaseComposeLintTest : LintDetectorTest() { ) """ .trimIndent() - ) + ), ) /** Optional override to customize the lint client name when running lint test tasks. */ diff --git a/compose-lint-checks/src/test/java/slack/lint/compose/ComposableFunctionNamingDetectorTest.kt b/compose-lint-checks/src/test/java/slack/lint/compose/ComposableFunctionNamingDetectorTest.kt index 497638f8..ffbf4ba4 100644 --- a/compose-lint-checks/src/test/java/slack/lint/compose/ComposableFunctionNamingDetectorTest.kt +++ b/compose-lint-checks/src/test/java/slack/lint/compose/ComposableFunctionNamingDetectorTest.kt @@ -19,7 +19,7 @@ class ComposableFunctionNamingDetectorTest : BaseComposeLintTest() { return super.lint() .configureOption( ComposableFunctionNamingDetector.ALLOWED_COMPOSABLE_FUNCTION_NAMES, - ".*Presenter" + ".*Presenter", ) } diff --git a/compose-lint-checks/src/test/java/slack/lint/compose/CompositionLocalUsageDetectorTest.kt b/compose-lint-checks/src/test/java/slack/lint/compose/CompositionLocalUsageDetectorTest.kt index 20e98a93..3d98a841 100644 --- a/compose-lint-checks/src/test/java/slack/lint/compose/CompositionLocalUsageDetectorTest.kt +++ b/compose-lint-checks/src/test/java/slack/lint/compose/CompositionLocalUsageDetectorTest.kt @@ -54,7 +54,7 @@ class CompositionLocalUsageDetectorTest : BaseComposeLintTest() { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0 errors, 4 warnings """ - .trimIndent() + .trimIndent(), ) .expect( """ diff --git a/compose-lint-checks/src/test/java/slack/lint/compose/ContentEmitterReturningValuesDetectorTest.kt b/compose-lint-checks/src/test/java/slack/lint/compose/ContentEmitterReturningValuesDetectorTest.kt index ecf02e5b..126d343c 100644 --- a/compose-lint-checks/src/test/java/slack/lint/compose/ContentEmitterReturningValuesDetectorTest.kt +++ b/compose-lint-checks/src/test/java/slack/lint/compose/ContentEmitterReturningValuesDetectorTest.kt @@ -19,7 +19,7 @@ class ContentEmitterReturningValuesDetectorTest : BaseComposeLintTest() { return super.lint() .configureOption( ContentEmitterReturningValuesDetector.CONTENT_EMITTER_OPTION, - "Potato,Banana" + "Potato,Banana", ) } diff --git a/compose-lint-checks/src/test/java/slack/lint/compose/M2ApiDetectorTest.kt b/compose-lint-checks/src/test/java/slack/lint/compose/M2ApiDetectorTest.kt index cb564ae7..9af05ebe 100644 --- a/compose-lint-checks/src/test/java/slack/lint/compose/M2ApiDetectorTest.kt +++ b/compose-lint-checks/src/test/java/slack/lint/compose/M2ApiDetectorTest.kt @@ -93,7 +93,7 @@ class M2ApiDetectorTest : BaseComposeLintTest() { } """ ) - .indented() + .indented(), ) .allowCompilationErrors() .run() @@ -133,7 +133,7 @@ class M2ApiDetectorTest : BaseComposeLintTest() { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 errors, 0 warnings """ - .trimIndent() + .trimIndent(), ) } } diff --git a/compose-lint-checks/src/test/java/slack/lint/compose/ModifierComposedDetectorTest.kt b/compose-lint-checks/src/test/java/slack/lint/compose/ModifierComposedDetectorTest.kt index 15df3df3..21e04b92 100644 --- a/compose-lint-checks/src/test/java/slack/lint/compose/ModifierComposedDetectorTest.kt +++ b/compose-lint-checks/src/test/java/slack/lint/compose/ModifierComposedDetectorTest.kt @@ -39,7 +39,7 @@ class ModifierComposedDetectorTest : BaseComposeLintTest() { TODO() } """ - .trimIndent() + .trimIndent(), ) override fun getDetector(): Detector = ModifierComposedDetector() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 73a7ae2e..03f96bab 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] kotlin = "1.9.22" -ktfmt = "0.46" +ktfmt = "0.47" jdk = "21" jvmTarget = "17" lint = "31.2.1"