Skip to content

Commit

Permalink
Apply formatting changes from the KtLint bump
Browse files Browse the repository at this point in the history
  • Loading branch information
RBusarow committed Nov 16, 2023
1 parent 4acf4bc commit 12c853d
Show file tree
Hide file tree
Showing 117 changed files with 1,669 additions and 1,590 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,15 @@ public annotation class ContributesBinding(
* are used together for the same class. If not, simply remove the qualifier from the class
* and don't use this parameter.
*/
val ignoreQualifier: Boolean = false
val ignoreQualifier: Boolean = false,
) {
/**
* The priority of a contributed binding.
*/
@Suppress("unused")
public enum class Priority {
NORMAL, HIGH, HIGHEST
NORMAL,
HIGH,
HIGHEST,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,5 @@ public annotation class ContributesMultibinding(
* are used together for the same class. If not, simply remove the qualifier from the class and
* don't use this parameter.
*/
val ignoreQualifier: Boolean = false
val ignoreQualifier: Boolean = false,
)
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public annotation class ContributesSubcomponent(
* This contributed subcomponent will replace these contributed subcomponents. All replaced
* subcomponents must use the same scope.
*/
val replaces: Array<KClass<*>> = []
val replaces: Array<KClass<*>> = [],
) {
/**
* A factory for a contributed subcomponent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ public annotation class ContributesTo(
* include other contributed bindings, multibindings and Dagger modules. All replaced classes
* must use the same scope.
*/
val replaces: Array<KClass<*>> = []
val replaces: Array<KClass<*>> = [],
)
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ public annotation class MergeComponent(
* List of bindings, multibindings, modules and component interfaces that are contributed to the
* same scope, but should be excluded from the component.
*/
val exclude: Array<KClass<*>> = []
val exclude: Array<KClass<*>> = [],
)
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ public annotation class MergeSubcomponent(
* List of bindings, multibindings, modules and component interfaces that are contributed to the
* same scope, but should be excluded from the subcomponent.
*/
val exclude: Array<KClass<*>> = []
val exclude: Array<KClass<*>> = [],
)
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ public annotation class MergeInterfaces(
* List of component interfaces that are contributed to the same scope, but should be excluded
* from the merged interface.
*/
val exclude: Array<KClass<*>> = []
val exclude: Array<KClass<*>> = [],
)
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ public annotation class MergeModules(
* List of bindings, multibindings and modules that are contributed to the same scope, but
* should be excluded from the merged module.
*/
val exclude: Array<KClass<*>> = []
val exclude: Array<KClass<*>> = [],
)
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ open class PublishConventionPlugin : Plugin<Project> {
configurePublication(
target,
mavenPublishing,
KotlinJvm(javadocJar = JavadocJar.Dokka("dokkaHtml"), sourcesJar = true)
KotlinJvm(javadocJar = JavadocJar.Dokka("dokkaHtml"), sourcesJar = true),
)
}
}
Expand All @@ -52,7 +52,7 @@ open class PublishConventionPlugin : Plugin<Project> {
private fun configurePublication(
target: Project,
mavenPublishing: MavenPublishBaseExtension,
platform: Platform
platform: Platform,
) {
mavenPublishing.configure(platform)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ open class CreateBenchmarkProjectTask : DefaultTask() {

val appModule = AppModule(
name = "app",
path = ":${rootDir.name}:app"
path = ":${rootDir.name}:app",
)

createSettingsGradleFile(libraryModules.values + appModule)
Expand Down Expand Up @@ -111,7 +111,7 @@ open class CreateBenchmarkProjectTask : DefaultTask() {

private fun createLibraryModule(
module: LibraryModule,
allLibraryModules: Map<Int, LibraryModule>
allLibraryModules: Map<Int, LibraryModule>,
) {
val moduleDir = File(rootDir, module.name)
createLibraryBuildGradleFile(module, allLibraryModules, moduleDir)
Expand All @@ -121,7 +121,7 @@ open class CreateBenchmarkProjectTask : DefaultTask() {
private fun createLibraryBuildGradleFile(
module: LibraryModule,
allLibraryModules: Map<Int, LibraryModule>,
moduleDir: File
moduleDir: File,
) {
val libDependency = allLibraryModules[module.index - 10]
?.let {
Expand Down Expand Up @@ -153,7 +153,7 @@ open class CreateBenchmarkProjectTask : DefaultTask() {

private fun createLibraryModuleSourceFiles(
module: LibraryModule,
moduleDir: File
moduleDir: File,
) {
val index = module.index
val group = index % 10
Expand Down Expand Up @@ -186,16 +186,16 @@ open class CreateBenchmarkProjectTask : DefaultTask() {
AnnotationSpec
.builder(contributesTo)
.addMember("scope = %T::class", scopeComponent)
.build()
.build(),
)
.addFunction(
FunSpec
.builder("boundInterface$index")
.addModifiers(ABSTRACT)
.returns(boundInterface)
.build()
.build(),
)
.build()
.build(),
)

addType(TypeSpec.interfaceBuilder(injectedInterface).build())
Expand All @@ -207,9 +207,9 @@ open class CreateBenchmarkProjectTask : DefaultTask() {
.builder(contributesSubcomponent)
.addMember("scope = %T::class", scopeSubcomponent)
.addMember("parentScope = %T::class", scopeComponent)
.build()
.build(),
)
.build()
.build(),
)
addType(
TypeSpec
Expand All @@ -218,16 +218,16 @@ open class CreateBenchmarkProjectTask : DefaultTask() {
AnnotationSpec
.builder(contributesTo)
.addMember("scope = %T::class", scopeSubcomponent)
.build()
.build(),
)
.addFunction(
FunSpec
.builder("injectedInterface$index")
.addModifiers(ABSTRACT)
.returns(injectedInterface)
.build()
.build(),
)
.build()
.build(),
)
}
}
Expand All @@ -250,10 +250,10 @@ open class CreateBenchmarkProjectTask : DefaultTask() {
addMember("replaces = [$template]", *replacedImpls.toTypedArray())
}
}
.build()
.build(),
)
.addSuperinterface(boundInterface)
.build()
.build(),
)
.addType(
TypeSpec
Expand All @@ -269,13 +269,13 @@ open class CreateBenchmarkProjectTask : DefaultTask() {
AnnotationSpec
.builder(Suppress::class)
.addMember("\"UNUSED_PARAMETER\"")
.build()
.build(),
)
.build()
.build(),
)
.build()
.build(),
)
.build()
.build(),
)
.addType(
TypeSpec
Expand All @@ -285,7 +285,7 @@ open class CreateBenchmarkProjectTask : DefaultTask() {
AnnotationSpec
.builder(contributesTo)
.addMember("scope = %T::class", scopeSubcomponent)
.build()
.build(),
)
.addFunction(
FunSpec
Expand All @@ -294,9 +294,9 @@ open class CreateBenchmarkProjectTask : DefaultTask() {
.addParameter("injectedInterfaceImpl", injectedInterfaceImpl)
.addStatement("return injectedInterfaceImpl")
.returns(injectedInterface)
.build()
.build(),
)
.build()
.build(),
)
.build()
.let { fileSpec ->
Expand All @@ -309,7 +309,7 @@ open class CreateBenchmarkProjectTask : DefaultTask() {

private fun createAppModule(
module: AppModule,
allLibraryModules: Map<Int, LibraryModule>
allLibraryModules: Map<Int, LibraryModule>,
) {
val moduleDir = File(rootDir, module.name)
createAppBuildGradleFile(allLibraryModules, moduleDir)
Expand All @@ -318,7 +318,7 @@ open class CreateBenchmarkProjectTask : DefaultTask() {

private fun createAppBuildGradleFile(
allLibraryModules: Map<Int, LibraryModule>,
moduleDir: File
moduleDir: File,
) {
val libDependencies = allLibraryModules.keys.sorted()
.let { it.subList(it.size - 10, it.size) }
Expand Down Expand Up @@ -356,7 +356,7 @@ open class CreateBenchmarkProjectTask : DefaultTask() {

private fun createAppModuleSourceFiles(
allLibraryModules: Map<Int, LibraryModule>,
moduleDir: File
moduleDir: File,
) {
val packageName = "com.squareup.anvil.benchmark.app"

Expand All @@ -377,9 +377,9 @@ open class CreateBenchmarkProjectTask : DefaultTask() {
AnnotationSpec
.builder(mergeComponent)
.addMember("scope = %T::class", scopeComponent)
.build()
.build(),
)
.build()
.build(),
)
}
}
Expand All @@ -400,9 +400,9 @@ open class CreateBenchmarkProjectTask : DefaultTask() {
}
addMember("replaces = [$template]", *replacedModules.toTypedArray())
}
.build()
.build(),
)
.build()
.build(),
)
.build()
.let { fileSpec ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,83 +25,83 @@ import org.jetbrains.kotlin.util.getExceptionMessage
public class AnvilCompilationException(
message: String,
cause: Throwable? = null,
element: PsiElement? = null
element: PsiElement? = null,
) : CompilationException(message, cause, element) {
public companion object {
public operator fun invoke(
annotationDescriptor: AnnotationDescriptor,
message: String,
cause: Throwable? = null
cause: Throwable? = null,
): AnvilCompilationException {
return AnvilCompilationException(
message = message,
cause = cause,
element = annotationDescriptor.identifier
element = annotationDescriptor.identifier,
)
}

public operator fun invoke(
functionDescriptor: FunctionDescriptor,
message: String,
cause: Throwable? = null
cause: Throwable? = null,
): AnvilCompilationException {
return AnvilCompilationException(
message = message,
cause = cause,
element = functionDescriptor.identifier
element = functionDescriptor.identifier,
)
}

public operator fun invoke(
parameterDescriptor: ValueParameterDescriptor,
message: String,
cause: Throwable? = null
cause: Throwable? = null,
): AnvilCompilationException {
return AnvilCompilationException(
message = message,
cause = cause,
element = parameterDescriptor.identifier
element = parameterDescriptor.identifier,
)
}

public operator fun invoke(
propertyDescriptor: PropertyDescriptor,
message: String,
cause: Throwable? = null
cause: Throwable? = null,
): AnvilCompilationException {
return AnvilCompilationException(
message = message,
cause = cause,
element = propertyDescriptor.identifier
element = propertyDescriptor.identifier,
)
}

public operator fun invoke(
classDescriptor: ClassDescriptor,
message: String,
cause: Throwable? = null
cause: Throwable? = null,
): AnvilCompilationException {
return AnvilCompilationException(
message = message,
cause = cause,
element = classDescriptor.identifier
element = classDescriptor.identifier,
)
}

public operator fun invoke(
element: IrElement? = null,
message: String,
cause: Throwable? = null
cause: Throwable? = null,
): AnvilCompilationException {
return AnvilCompilationException(
message = getExceptionMessage(
subsystemName = "Anvil",
message = message,
cause = cause,
location = element?.render()
location = element?.render(),
),
cause = cause,
element = element?.psi
element = element?.psi,
).apply {
if (element != null) {
withAttachment("element.kt", element.render())
Expand All @@ -117,7 +117,7 @@ public class AnvilCompilationException(
return AnvilCompilationException(
message = message,
cause = cause,
element = element?.owner
element = element?.owner,
)
}
}
Expand Down
Loading

0 comments on commit 12c853d

Please sign in to comment.