Skip to content

Commit 4a2538e

Browse files
committed
Update ktlint plugin to org.jlleitschuh.gradle.ktlint:13.1.0 and ktlint 1.7.1
1 parent d96e454 commit 4a2538e

File tree

28 files changed

+192
-104
lines changed

28 files changed

+192
-104
lines changed

Ext/Accessibility/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,3 @@ android {
9494
afterEvaluate {
9595
apply from: "../../publish.build.gradle"
9696
}
97-
98-
apply from: '../../ktlint.gradle'

Ext/Compose/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,3 @@ android {
112112
afterEvaluate {
113113
apply from: "../../publish.build.gradle"
114114
}
115-
116-
apply from: '../../ktlint.gradle'

Ext/Fullscreen/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,3 @@ android {
9292
afterEvaluate {
9393
apply from: "../../publish.build.gradle"
9494
}
95-
96-
apply from: '../../ktlint.gradle'

Library/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ afterEvaluate {
124124
apply from: "../publish.build.gradle"
125125
}
126126

127-
apply from: '../ktlint.gradle'
128-
129127
tasks.withType(Test) {
130128
jacoco.includeNoLocationClasses = true
131129
jacoco.excludes = ['jdk.internal.*']

Library/src/main/java/dev/testify/output/TestStorageDestination.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ class TestStorageDestination(
107107
if (outputStream == null) return false
108108
val buffer = ByteArray(1024)
109109
var length: Int
110-
while (inputStream.read(buffer).also { length = it } > 0)
110+
while (inputStream.read(buffer).also { length = it } > 0) {
111111
outputStream.write(buffer, 0, length)
112+
}
112113
}
113114
}
114115
return true

Library/src/main/java/dev/testify/scenario/ScreenshotScenarioRule.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,19 +301,21 @@ open class ScreenshotScenarioRule @JvmOverloads constructor(
301301
scenario?.onActivity { activity = it }
302302

303303
if (activity != null) {
304-
if (configuration.fontScale != null)
304+
if (configuration.fontScale != null) {
305305
throw NoResourceConfigurationOnScenarioException(
306306
cause = "fontScale",
307307
value = configuration.fontScale.toString(),
308308
activity = activity?.javaClass?.simpleName.orEmpty()
309309
)
310+
}
310311

311-
if (configuration.locale != null)
312+
if (configuration.locale != null) {
312313
throw NoResourceConfigurationOnScenarioException(
313314
cause = "locale",
314315
value = configuration.locale.toString(),
315316
activity = activity?.javaClass?.simpleName.orEmpty()
316317
)
318+
}
317319
}
318320

319321
return this
@@ -430,11 +432,12 @@ open class ScreenshotScenarioRule @JvmOverloads constructor(
430432
methodAnnotations
431433
)
432434

433-
if (annotation == null)
435+
if (annotation == null) {
434436
this.throwable = MissingScreenshotInstrumentationAnnotationException(
435437
annotationName = getScreenshotAnnotationName(),
436438
methodName = methodName
437439
)
440+
}
438441
}
439442

440443
/**
@@ -447,8 +450,9 @@ open class ScreenshotScenarioRule @JvmOverloads constructor(
447450

448451
getInstrumentation().waitForIdleSync()
449452

450-
if (configuration.hideSoftKeyboard)
453+
if (configuration.hideSoftKeyboard) {
451454
closeSoftKeyboard()
455+
}
452456
}
453457

454458
/**
@@ -501,8 +505,8 @@ open class ScreenshotScenarioRule @JvmOverloads constructor(
501505
} ?: throw ScenarioRequiredException()
502506
}
503507

504-
context (scenario: ActivityScenario<*>)
505508
@JvmName("assertSameContext")
509+
context (scenario: ActivityScenario<*>)
506510
fun assertSame() {
507511
assertSame(scenario)
508512
}

Plugins/Gradle/build.gradle

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ plugins {
99
id 'jacoco'
1010
id 'maven-publish'
1111
id 'signing'
12+
id 'org.jlleitschuh.gradle.ktlint' version '13.1.0'
1213
}
1314

1415
def gradleProperties = new Properties()
@@ -102,7 +103,6 @@ tasks.register('javadocJar', Jar) {
102103
}
103104

104105
apply from: "../../publish.build.gradle"
105-
apply from: '../../ktlint.gradle'
106106

107107
jacoco {
108108
toolVersion = "0.8.12"
@@ -117,3 +117,17 @@ jacocoTestReport {
117117
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
118118
}
119119
}
120+
121+
ktlint {
122+
version.set("1.7.1")
123+
additionalEditorconfig.set([
124+
"ktlint_code_style" : "android_studio", // Use Android Studio code style defaults
125+
"ktlint_standard_class-signature" : "disabled", // Disable class signature wrapping enforcement
126+
"ktlint_standard_function-expression-body" : "disabled", // Function body should be replaced with body expression
127+
"ktlint_standard_function-signature" : "disabled", // Disable function signature wrapping enforcement
128+
"ktlint_standard_import-ordering" : "disabled", // Disable import ordering rule
129+
"ktlint_standard_no-unused-imports" : "enabled", // Enable unused-imports rule
130+
"ktlint_standard_property-naming" : "disabled", // Disable property naming convention checks
131+
"max_line_length" : "200" // Max line length before ktlint enforces wrapping
132+
])
133+
}

Plugins/Gradle/src/main/kotlin/dev/testify/internal/Adb.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ class Adb {
7171
arguments("--user", "$forcedUser")
7272
} else {
7373
val user = Device.user
74-
if (user.isNotEmpty() && (user.toIntOrNull() ?: 0) > 0)
74+
if (user.isNotEmpty() && (user.toIntOrNull() ?: 0) > 0) {
7575
arguments("--user", user)
76+
}
7677
}
7778
return this
7879
}
@@ -111,7 +112,6 @@ class Adb {
111112
}
112113

113114
fun testOptions(testOptionsBuilder: TestOptionsBuilder): Adb {
114-
115115
testOptionsBuilder.resolved.forEach {
116116
arguments.add(TestOptionsBuilder.TEST_OPTIONS_FLAG)
117117
arguments.add(it)

Plugins/Gradle/src/main/kotlin/dev/testify/internal/DeviceUtilities.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,18 @@ import java.io.File
3333

3434
internal val Project.root: String
3535
@Suppress("SdCardPath")
36-
get() = testifySettings.rootDestinationDirectory ?: if (testifySettings.useSdCard)
36+
get() = testifySettings.rootDestinationDirectory ?: if (testifySettings.useSdCard) {
3737
"/sdcard/Android/data/${testifySettings.targetPackageId}/files/testify_"
38-
else
38+
} else {
3939
"./app_"
40+
}
4041

4142
internal val Project.screenshotDirectory: String
42-
get() = if (testifySettings.useSdCard)
43+
get() = if (testifySettings.useSdCard) {
4344
"${root}images/"
44-
else
45+
} else {
4546
"${root}images/$SCREENSHOT_DIR"
47+
}
4648

4749
internal fun Adb.listFiles(path: String): List<String> {
4850
val log = this

Plugins/Gradle/src/main/kotlin/dev/testify/tasks/internal/ReportTask.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ import org.gradle.api.tasks.Internal
3030

3131
abstract class ReportTask : TestifyDefaultTask() {
3232

33-
@get:Input lateinit var reportFileName: String
34-
@get:Input lateinit var reportPath: String
33+
@get:Input
34+
lateinit var reportFileName: String
35+
36+
@get:Input
37+
lateinit var reportPath: String
3538

3639
override fun getGroup() = "Testify reports"
3740

0 commit comments

Comments
 (0)