Skip to content

Commit

Permalink
Merge pull request #784 from square/rick/ktlint
Browse files Browse the repository at this point in the history
bumping KtLint to 1.0.1, ktlint-gradle to 11.6.1
  • Loading branch information
RBusarow authored Nov 18, 2023
2 parents 4201903 + 12c853d commit 18ae172
Show file tree
Hide file tree
Showing 119 changed files with 1,697 additions and 1,599 deletions.
33 changes: 26 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ ij_formatter_tags_enabled = false
ij_smart_tabs = false
ij_wrap_on_typing = false

# Back-ticked method names are allowed to exceed the line length. That's especially helpful for
# test methods with descriptive names.
ktlint_ignore_back_ticked_identifier=true

[*.java]
ij_java_align_consecutive_assignments = false
ij_java_align_consecutive_variable_declarations = false
Expand Down Expand Up @@ -483,16 +479,39 @@ ij_groovy_while_brace_force = if_multiline
ij_groovy_while_on_new_line = false
ij_groovy_wrap_long_lines = false

[{*.gradle.kts,*.kt,*.kts,*.main.kts}]
# These KtLint-specific settings have their own section so that we can suppress the
# 'EditorConfigKeyCorrectness' warning in one place. IntelliJ doesn't recognize the KtLint settings.
# noinspection EditorConfigKeyCorrectness
# noinspection EditorConfigHeaderUniqueness
[{*.kt,*.kts}]
kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^
# Back-ticked method names are allowed to exceed the line length. That's especially helpful for
# test methods with descriptive names.
ktlint_ignore_back_ticked_identifier = true

ktlint_code_style = intellij_idea

ktlint_standard_class-naming = disabled
ktlint_standard_class-signature = disabled
ktlint_standard_filename = disabled
ktlint_standard_function-expression-body = disabled
ktlint_standard_function-naming = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_max-line-length = disabled
ktlint_standard_no-empty-first-line-in-method-block = disabled
ktlint_standard_property-naming = disabled

# noinspection EditorConfigHeaderUniqueness
[{*.kt,*.kts}]
ij_continuation_indent_size = 2
ij_kotlin_align_in_columns_case_branch = false
ij_kotlin_align_multiline_binary_operation = false
ij_kotlin_align_multiline_extends_list = false
ij_kotlin_align_multiline_method_parentheses = false
ij_kotlin_align_multiline_parameters = false
ij_kotlin_align_multiline_parameters_in_calls = false
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
ij_kotlin_assignment_wrap = normal
ij_kotlin_blank_lines_after_class_header = 0
ij_kotlin_blank_lines_around_block_when_branches = 0
Expand Down
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
Loading

0 comments on commit 18ae172

Please sign in to comment.