JakeWharton / timber

A logger with a small, extensible API which provides utility on top of Android's normal Log class.
https://jakewharton.github.io/timber/docs/5.x/
Apache License 2.0
10.41k stars 959 forks source link

TimberArgCount false positive for String.format result #434

Closed seadowg closed 3 years ago

seadowg commented 3 years ago

We have the following code in our app (we're using Timber 4.7.1):

String message = String.format("Cannot create directory: %s", dirPath);
Timber.w(message);

The message is used elsewhere, so we use a String.format instead of Timber's formatting. Interestingly, after upgrading to Android Studio Arctic Fox (and consequently Android Gradle plugin 7.0.0/Java 11 JDK) we are getting Android lint errors from the above code:

Wrong argument count, format string Cannot create directory: %s requires 1 but format call supplies 0

For the moment, I've added an ignore to lint.xml to work around this.