Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to suppress spellcheck on a string constant in Android Kotlin?

Android Lint picks up the string constant in this code sample as a spelling error on "dWQGSCDx". According to the docs I should use @SupressLint("Typos") to suppress it but that doesn't achieve that. I see others have suggested using @SuppressWarnings but that is not working either.

/**
 * Constants.kt
 */

import android.annotation.SuppressLint

@SuppressLint("Typos")
@SuppressWarnings("SpellCheckingInspection")    
const val SOME_STRING_VALUE = "...dWQGSCDx..."

Note this is a file-scoped global constant, it is not inside a class so an annotation cannot be placed on a containing class.

How do I suppress spell-checking of this constant definition without disabling spellcheck entirely and without adding the "mispelt" text to the dictionary?

like image 592
Ollie C Avatar asked Feb 04 '23 03:02

Ollie C


1 Answers

In Kotlin you can suppress this warning using @Suppress instead of @SuppressWarnings with the following annotation

@Suppress("SpellCheckingInspection")
like image 117
Borja Quevedo Avatar answered Feb 08 '23 15:02

Borja Quevedo