Add BinaryOperationInTimber lint rule and fix existing errors

This commit is contained in:
Benoit Marty 2020-03-05 10:40:36 +01:00
parent d6cdcc60d1
commit b10e9c54b4
7 changed files with 14 additions and 11 deletions

View file

@ -46,4 +46,7 @@
<!-- Manifest -->
<issue id="PermissionImpliesUnsupportedChromeOsHardware" severity="error" />
<!-- Timber -->
<issue id="BinaryOperationInTimber" severity="error" />
</lint>

View file

@ -144,10 +144,10 @@ fun openCamera(activity: Activity, titlePrefix: String, requestCode: Int): Strin
Timber.e("Cannot use the external storage media to save image")
}
} catch (uoe: UnsupportedOperationException) {
Timber.e(uoe, "Unable to insert camera URI into MediaStore.Images.Media.EXTERNAL_CONTENT_URI " +
"no SD card? Attempting to insert into device storage.")
Timber.e(uoe, "Unable to insert camera URI into MediaStore.Images.Media.EXTERNAL_CONTENT_URI.")
Timber.e("no SD card? Attempting to insert into device storage.")
} catch (e: Exception) {
Timber.e(e, "Unable to insert camera URI into MediaStore.Images.Media.EXTERNAL_CONTENT_URI. $e")
Timber.e(e, "Unable to insert camera URI into MediaStore.Images.Media.EXTERNAL_CONTENT_URI.")
}
if (null == dummyUri) {
@ -157,13 +157,13 @@ fun openCamera(activity: Activity, titlePrefix: String, requestCode: Int): Strin
Timber.e("Cannot use the internal storage to save media to save image")
}
} catch (e: Exception) {
Timber.e(e, "Unable to insert camera URI into internal storage. Giving up. $e")
Timber.e(e, "Unable to insert camera URI into internal storage. Giving up.")
}
}
if (dummyUri != null) {
captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, dummyUri)
Timber.v("trying to take a photo on " + dummyUri.toString())
Timber.v("trying to take a photo on $dummyUri")
} else {
Timber.v("trying to take a photo with no predefined uri")
}

View file

@ -36,8 +36,8 @@ class VectorConfiguration @Inject constructor(private val context: Context) {
// TODO Import mLanguageReceiver From Riot?
fun onConfigurationChanged() {
if (Locale.getDefault().toString() != VectorLocale.applicationLocale.toString()) {
Timber.v("## onConfigurationChanged() : the locale has been updated to " + Locale.getDefault().toString()
+ ", restore the expected value " + VectorLocale.applicationLocale.toString())
Timber.v("## onConfigurationChanged(): the locale has been updated to ${Locale.getDefault()}")
Timber.v("## onConfigurationChanged(): restore the expected value ${VectorLocale.applicationLocale}")
updateApplicationSettings(VectorLocale.applicationLocale,
FontScale.getFontScalePrefValue(context),
ThemeUtils.getApplicationTheme(context))

View file

@ -74,7 +74,7 @@ class KeysBackupRestoreFromPassphraseViewModel @Inject constructor() : ViewModel
isIndeterminate = true))
}
is StepProgressListener.Step.ImportingKey -> {
Timber.d("backupKeys.ImportingKey.progress: " + step.progress)
Timber.d("backupKeys.ImportingKey.progress: ${step.progress}")
// Progress 0 can take a while, display an indeterminate progress in this case
if (step.progress == 0) {
sharedViewModel.loadingEvent.postValue(WaitingViewData(context.getString(R.string.keys_backup_restoring_waiting_message)

View file

@ -89,7 +89,7 @@ class LoginCaptchaFragment @Inject constructor(
}
override fun onReceivedSslError(view: WebView, handler: SslErrorHandler, error: SslError) {
Timber.d("## onReceivedSslError() : " + error.certificate)
Timber.d("## onReceivedSslError() : ${error.certificate}")
if (!isAdded) {
return

View file

@ -99,9 +99,9 @@ class VectorUncaughtExceptionHandler @Inject constructor(private val bugReporter
val pw = PrintWriter(sw, true)
throwable.printStackTrace(pw)
b.append(sw.buffer.toString())
Timber.e("FATAL EXCEPTION " + b.toString())
val bugDescription = b.toString()
Timber.e("FATAL EXCEPTION $bugDescription")
bugReporter.saveCrashReport(context, bugDescription)

View file

@ -423,7 +423,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)
}
Timber.v("## getNotificationRingTone() returns " + uri!!)
Timber.v("## getNotificationRingTone() returns $uri")
return uri
}