Skip to content

Commit d96e454

Browse files
committed
Fix ktlint violations
1 parent 60dcf9d commit d96e454

40 files changed

Lines changed: 84 additions & 75 deletions

.editorconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
[*.{kt,kts}]
2-
disabled_rules=import-ordering
2+
ktlint_standard_trailing-comma-on-call-site = disabled
3+
ktlint_standard_trailing-comma-on-declaration-site = disabled
34
indent_size=4
45
insert_final_newline=true
56
max_line_length=120
67
trim_trailing_whitespace=true
78
end_of_line=lf
89
ij_kotlin_name_count_to_use_star_import = 2147483647
910
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
11+

Ext/Accessibility/src/main/java/dev/testify/accessibility/internal/CheckResults.kt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,18 @@ internal class CheckResults(other: List<CheckResult>) : ArrayList<CheckResult>(o
5656
return if (this.any { it.type == type }) " * $type:\n${this.prettyPrint(type)}" else ""
5757
}
5858

59-
private fun List<CheckResult>.prettyPrint(filter: String): String {
60-
return if (this.isEmpty())
61-
" * - [NONE]"
62-
else
63-
filter { it.type == filter }.joinToString(separator = "\n * -", prefix = " * -") {
64-
"${it.check}: [${it.elementClass}/${it.resourceName}] - ${it.message}"
65-
}
66-
}
59+
private fun List<CheckResult>.prettyPrint(filter: String) =
60+
prettyPrintEmpty().takeIf { isEmpty() } ?: prettyPrintNotEmpty(filter)
61+
62+
private fun prettyPrintEmpty() = " * - [NONE]"
63+
64+
private fun List<CheckResult>.prettyPrintNotEmpty(filter: String) = filter { it.type == filter }
65+
.joinToString(
66+
separator = "\n * -",
67+
prefix = " * -"
68+
) {
69+
"${it.check}: [${it.elementClass}/${it.resourceName}] - ${it.message}"
70+
}
6771

6872
companion object {
6973
fun fromJson(json: Reader): CheckResults {

Ext/Compose/src/main/java/dev/testify/ComposableScreenshotRule.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,12 @@ open class ComposableScreenshotRule(
185185
*/
186186
override fun beforeScreenshot(activity: Activity) {
187187
val targetView = activity.findRootView(rootViewId).getChildAt(0)
188-
if (targetView.width == 0 && targetView.height == 0)
188+
if (targetView.width == 0 && targetView.height == 0) {
189189
throw IllegalStateException(
190190
"Target view has 0 size. " +
191191
"Verify if you have provided a ComposeTestRule instance to ComposableScreenshotRule."
192192
)
193+
}
193194

194195
super.beforeScreenshot(activity)
195196
}

Ext/Compose/src/main/java/dev/testify/compose/exception/ComposeContainerNotFoundException.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* The MIT License (MIT)
33
*
44
* Copyright (c) 2024 ndtp
5-
*
5+
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
88
* in the Software without restriction, including without limitation the rights

Ext/Compose/src/main/java/dev/testify/compose/scenario/ComposableScreenshotScenarioRule.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* The MIT License (MIT)
33
*
44
* Copyright (c) 2024 ndtp
5-
*
5+
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
88
* in the Software without restriction, including without limitation the rights
@@ -206,12 +206,12 @@ open class ComposableScreenshotScenarioRule(
206206
*/
207207
override fun beforeScreenshot(activity: Activity) {
208208
val targetView = activity.findRootView(rootViewId).getChildAt(0)
209-
if (targetView.width == 0 && targetView.height == 0)
209+
if (targetView.width == 0 && targetView.height == 0) {
210210
throw IllegalStateException(
211-
"Target view has 0 size. " +
211+
"Target view has 0 size." +
212212
"Verify if you have provided a ComposeTestRule instance to ComposableScreenshotRule."
213213
)
214-
214+
}
215215
super.beforeScreenshot(activity)
216216
}
217217

Ext/Compose/src/main/java/dev/testify/compose/scenario/LaunchComposableTestActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* The MIT License (MIT)
33
*
44
* Copyright (c) 2024 ndtp
5-
*
5+
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
88
* in the Software without restriction, including without limitation the rights

Ext/Fullscreen/src/main/java/dev/testify/capture/fullscreen/FullscreenCaptureMethod.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ import dev.testify.testDescription
6767
*/
6868
@Suppress("UNUSED_PARAMETER")
6969
fun fullscreenCapture(activity: Activity, targetView: View?): Bitmap {
70-
7170
val instrumentation = getInstrumentation()
7271
val fileName = getFileName(instrumentation.context)
7372
val destination = getDestination(activity, fileName)

Ext/Fullscreen/src/main/java/dev/testify/capture/fullscreen/provider/RealDisplaySize.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ val Context.realDisplaySize: Size
4848
} else {
4949
(getSystemService(Context.WINDOW_SERVICE) as WindowManager).defaultDisplay
5050
}?.getRealSize(screenSize)
51-
return if (resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT)
51+
return if (resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) {
5252
Size(screenSize.x, screenSize.y)
53-
else
53+
} else {
5454
Size(screenSize.y, screenSize.x)
55+
}
5556
}

Library/src/androidTest/java/dev/testify/AssertExpectedDeviceTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* The MIT License (MIT)
33
*
44
* Copyright (c) 2023 ndtp
5-
*
5+
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
88
* in the Software without restriction, including without limitation the rights

Library/src/androidTest/java/dev/testify/RuleLifecycleTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ class RuleLifecycleTest {
7373
}
7474

7575
@Suppress("DEPRECATION")
76-
@get:Rule val thrown: ExpectedException = ExpectedException.none()
76+
@get:Rule
77+
val thrown: ExpectedException = ExpectedException.none()
7778

7879
@ScreenshotInstrumentation
7980
@Test

0 commit comments

Comments
 (0)