Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency com.facebook:ktfmt to v0.47 #239

Merged
merged 4 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ allprojects {
endWithNewline()
licenseHeaderFile(
rootProject.file("spotless/spotless.kt"),
"(import|plugins|buildscript|dependencies|pluginManagement)"
"(import|plugins|buildscript|dependencies|pluginManagement)",
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -46,7 +46,7 @@ constructor(
category = Category.PRODUCTIVITY,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<ComposableFunctionNamingDetector>()
implementation = sourceImplementation<ComposableFunctionNamingDetector>(),
)
.setOptions(listOf(ALLOWED_COMPOSABLE_FUNCTION_NAMES))

Expand All @@ -63,7 +63,7 @@ constructor(
category = Category.PRODUCTIVITY,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<ComposableFunctionNamingDetector>()
implementation = sourceImplementation<ComposableFunctionNamingDetector>(),
)
.setOptions(listOf(ALLOWED_COMPOSABLE_FUNCTION_NAMES))

Expand All @@ -88,7 +88,7 @@ constructor(
ISSUE_UPPERCASE,
function,
context.getNameLocation(function),
ISSUE_UPPERCASE.getExplanation(TextFormat.TEXT)
ISSUE_UPPERCASE.getExplanation(TextFormat.TEXT),
)
}
} else {
Expand All @@ -98,7 +98,7 @@ constructor(
ISSUE_LOWERCASE,
function,
context.getNameLocation(function),
ISSUE_LOWERCASE.getExplanation(TextFormat.TEXT)
ISSUE_LOWERCASE.getExplanation(TextFormat.TEXT),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -44,7 +44,7 @@ class CompositionLocalUsageDetector : Detector(), SourceCodeScanner {
category = Category.PRODUCTIVITY,
priority = Priorities.NORMAL,
severity = Severity.WARNING,
implementation = sourceImplementation<CompositionLocalUsageDetector>()
implementation = sourceImplementation<CompositionLocalUsageDetector>(),
)
.setOptions(listOf(ALLOW_LIST))

Expand Down Expand Up @@ -78,7 +78,7 @@ class CompositionLocalUsageDetector : Detector(), SourceCodeScanner {
ISSUE,
node,
context.getLocation(node),
ISSUE.getExplanation(TextFormat.TEXT)
ISSUE.getExplanation(TextFormat.TEXT),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ constructor(
category = Category.PRODUCTIVITY,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<ContentEmitterReturningValuesDetector>()
implementation = sourceImplementation<ContentEmitterReturningValuesDetector>(),
)
.setOptions(listOf(CONTENT_EMITTER_OPTION))
}
Expand Down Expand Up @@ -119,7 +119,7 @@ constructor(
ISSUE,
composable,
context.getLocation(composable),
ISSUE.getExplanation(TextFormat.TEXT)
ISSUE.getExplanation(TextFormat.TEXT),
)
}

Expand Down Expand Up @@ -157,7 +157,7 @@ constructor(
ISSUE,
composable,
context.getLocation(composable),
ISSUE.getExplanation(TextFormat.TEXT)
ISSUE.getExplanation(TextFormat.TEXT),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -49,7 +49,7 @@ constructor(private val allowList: StringSetLintOption = StringSetLintOption(ALL
category = CORRECTNESS,
priority = NORMAL,
severity = ERROR,
implementation = sourceImplementation<M2ApiDetector>()
implementation = sourceImplementation<M2ApiDetector>(),
)
.setOptions(listOf(ALLOW_LIST))
.setEnabledByDefault(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ModifierComposableDetector : ComposableFunctionDetector(), SourceCodeScann
category = Category.CORRECTNESS,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<ModifierComposableDetector>()
implementation = sourceImplementation<ModifierComposableDetector>(),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,11 @@ class ModifierComposedDetector : Detector(), SourceCodeScanner {
category = Category.CORRECTNESS,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<ModifierComposedDetector>()
implementation = sourceImplementation<ModifierComposedDetector>(),
)
}

override fun getApplicableUastTypes() =
listOf<Class<out UElement>>(
UCallExpression::class.java,
)
override fun getApplicableUastTypes() = listOf<Class<out UElement>>(UCallExpression::class.java)

override fun createUastHandler(context: JavaContext): UElementHandler? {
if (!isKotlin(context.uastFile?.lang)) return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -54,7 +54,7 @@ constructor(
category = Category.PRODUCTIVITY,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<ModifierMissingDetector>()
implementation = sourceImplementation<ModifierMissingDetector>(),
)
.setOptions(listOf(CONTENT_EMITTER_OPTION, VISIBILITY_THRESHOLD))
}
Expand Down Expand Up @@ -97,7 +97,7 @@ constructor(
ISSUE,
function,
context.getNameLocation(function),
ISSUE.getExplanation(TextFormat.TEXT)
ISSUE.getExplanation(TextFormat.TEXT),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ constructor(
category = Category.PRODUCTIVITY,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<ModifierReusedDetector>()
implementation = sourceImplementation<ModifierReusedDetector>(),
)
.setOptions(listOf(CONTENT_EMITTER_OPTION))
}
Expand Down Expand Up @@ -108,7 +108,7 @@ constructor(
ISSUE,
callExpression,
context.getLocation(callExpression),
ISSUE.getExplanation(TextFormat.TEXT)
ISSUE.getExplanation(TextFormat.TEXT),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ModifierWithoutDefaultDetector : ComposableFunctionDetector(), SourceCodeS
category = Category.PRODUCTIVITY,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<ModifierWithoutDefaultDetector>()
implementation = sourceImplementation<ModifierWithoutDefaultDetector>(),
)
}

Expand Down Expand Up @@ -74,7 +74,7 @@ class ModifierWithoutDefaultDetector : ComposableFunctionDetector(), SourceCodeS
.text(currentText)
.with("$currentText = Modifier")
.autoFix()
.build()
.build(),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ constructor(
category = Category.PRODUCTIVITY,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<MultipleContentEmittersDetector>()
implementation = sourceImplementation<MultipleContentEmittersDetector>(),
)
.setOptions(listOf(CONTENT_EMITTER_OPTION))
}
Expand Down Expand Up @@ -154,7 +154,7 @@ constructor(
ISSUE,
composable,
context.getLocation(composable),
ISSUE.getExplanation(TextFormat.TEXT)
ISSUE.getExplanation(TextFormat.TEXT),
)
}

Expand Down Expand Up @@ -193,7 +193,7 @@ constructor(
ISSUE,
composable,
context.getLocation(composable),
ISSUE.getExplanation(TextFormat.TEXT)
ISSUE.getExplanation(TextFormat.TEXT),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MutableParametersDetector : ComposableFunctionDetector(), SourceCodeScanne
category = Category.PRODUCTIVITY,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<MutableParametersDetector>()
implementation = sourceImplementation<MutableParametersDetector>(),
)
}

Expand All @@ -42,7 +42,7 @@ class MutableParametersDetector : ComposableFunctionDetector(), SourceCodeScanne
ISSUE,
parameter.typeReference,
context.getLocation(parameter.typeReference),
ISSUE.getExplanation(TextFormat.TEXT)
ISSUE.getExplanation(TextFormat.TEXT),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ParameterOrderDetector : ComposableFunctionDetector(), SourceCodeScanner {
fun createErrorMessage(currentOrder: List<UParameter>, properOrder: List<UParameter>): String =
createErrorMessage(
currentOrder.joinToString { it.text },
properOrder.joinToString { it.text }
properOrder.joinToString { it.text },
)

private fun createErrorMessage(currentOrder: String, properOrder: String): String =
Expand All @@ -46,7 +46,7 @@ class ParameterOrderDetector : ComposableFunctionDetector(), SourceCodeScanner {
category = Category.PRODUCTIVITY,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<ParameterOrderDetector>()
implementation = sourceImplementation<ParameterOrderDetector>(),
)
}

Expand Down Expand Up @@ -100,7 +100,7 @@ class ParameterOrderDetector : ComposableFunctionDetector(), SourceCodeScanner {
.range(errorLocation)
.with(properOrder.joinToString(prefix = "(", postfix = ")") { it.text })
.reformat(true)
.build()
.build(),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PreviewNamingDetector : Detector(), SourceCodeScanner {
category = Category.PRODUCTIVITY,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<PreviewNamingDetector>()
implementation = sourceImplementation<PreviewNamingDetector>(),
)
}

Expand Down Expand Up @@ -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) }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -51,7 +51,7 @@ constructor(
category = Category.PRODUCTIVITY,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<PreviewPublicDetector>()
implementation = sourceImplementation<PreviewPublicDetector>(),
)
.setOptions(listOf(PREVIEW_PUBLIC_ONLY_IF_PARAMS_OPTION))
}
Expand Down Expand Up @@ -107,7 +107,7 @@ constructor(
function,
context.getLocation(function),
ISSUE.getExplanation(TextFormat.TEXT),
fix
fix,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RememberMissingDetector : ComposableFunctionDetector(), SourceCodeScanner
category = Category.PRODUCTIVITY,
priority = Priorities.NORMAL,
severity = Severity.ERROR,
implementation = sourceImplementation<RememberMissingDetector>()
implementation = sourceImplementation<RememberMissingDetector>(),
)
}

Expand All @@ -60,15 +60,15 @@ class RememberMissingDetector : ComposableFunctionDetector(), SourceCodeScanner
ISSUE,
callExpression,
context.getLocation(callExpression),
MutableStateOfNotRemembered
MutableStateOfNotRemembered,
)
}
"derivedStateOf" -> {
context.report(
ISSUE,
callExpression,
context.getLocation(callExpression),
DerivedStateOfNotRemembered
DerivedStateOfNotRemembered,
)
}
}
Expand Down
Loading