Skip to content
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 gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ assertk = "com.willowtreeapps.assertk:assertk:0.28.1"
robolectric = "org.robolectric:robolectric:4.16.1"

spotlessPlugin = "com.diffplug.spotless:spotless-plugin-gradle:8.3.0"
ktfmt = "com.facebook:ktfmt:0.61"
ktfmt = "com.facebook:ktfmt:0.62"
Original file line number Diff line number Diff line change
Expand Up @@ -520,15 +520,15 @@ class WrongTimberUsageDetector : Detector(), UastScanner {
val numArguments = arguments.size

// Find the throwable and message arguments by their type, not by their position.
val throwableArgument =
arguments.firstOrNull { isSubclassOf(context, it, Throwable::class.java) }
val throwableArgument = arguments.firstOrNull {
isSubclassOf(context, it, Throwable::class.java)
}

// Find an argument that is either a String OR a literal null expression.
val messageArgument =
arguments.firstOrNull {
val type = it.getExpressionType()
(type != null && isString(type)) || (it is ULiteralExpression && it.isNull)
}
val messageArgument = arguments.firstOrNull {
val type = it.getExpressionType()
(type != null && isString(type)) || (it is ULiteralExpression && it.isNull)
}

// Handles overloads like Timber.d(t, "message").
if (throwableArgument != null && messageArgument != null) {
Expand Down