0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 03:52:15 +02:00

refactor: ignore "UnstableApiUsage" lint warnings

We're aware that these classes are using `@Beta` functionality

Removes a lot of IDE lint warnings
This commit is contained in:
David Allison 2022-05-11 01:51:23 +01:00
parent a145c032fd
commit 330854683f
21 changed files with 22 additions and 9 deletions

View File

@ -1,3 +1,4 @@
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint
import com.android.tools.lint.client.api.IssueRegistry

View File

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.detector.api.Implementation
@ -30,8 +31,6 @@ import java.util.*
* https://github.com/ankidroid/Anki-Android/wiki/Code-style#constant-final-variables-names-must-be-all-uppercase-using-underscore-to-separate-words
* Constant (final variables) names must be all uppercase using underscore to separate words.
*/
@KotlinCleanup("IDE warnings")
@KotlinCleanup("Ignore unstable API warning")
@KotlinCleanup("Remove after all are converted")
class ConstantJavaFieldDetector : JavaFieldNamingPatternDetector() {
override fun isApplicable(variable: UVariable): Boolean {

View File

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.detector.api.*

View File

@ -1,3 +1,4 @@
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.detector.api.*

View File

@ -1,3 +1,4 @@
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.detector.api.*

View File

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.detector.api.*

View File

@ -1,16 +1,15 @@
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.resources.ResourceFolderType
import com.android.tools.lint.detector.api.*
import com.google.common.annotations.VisibleForTesting
import com.ichi2.anki.lint.utils.Constants
import com.ichi2.anki.lint.utils.KotlinCleanup
import org.w3c.dom.Element
/**
* A Lint check to prevent using the same string for the title and summary of a preference.
*/
@KotlinCleanup("IDe lint")
class DuplicateTextInPreferencesXml : ResourceXmlDetector() {
companion object {

View File

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.resources.ResourceFolderType

View File

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.detector.api.*
@ -22,7 +23,7 @@ import com.ichi2.anki.lint.utils.ImportStatementDetector
import com.ichi2.anki.lint.utils.KotlinCleanup
import org.jetbrains.uast.UImportStatement
@KotlinCleanup("IDE lint - ignore 'Beta'")
@KotlinCleanup("IDE lint")
class InconsistentAnnotationUsage : ImportStatementDetector(), SourceCodeScanner {
companion object {

View File

@ -14,6 +14,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.SdkConstants.*

View File

@ -14,6 +14,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.detector.api.*

View File

@ -13,17 +13,16 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.client.api.UElementHandler
import com.android.tools.lint.detector.api.Detector
import com.android.tools.lint.detector.api.JavaContext
import com.ichi2.anki.lint.utils.KotlinCleanup
import org.jetbrains.uast.UElement
import org.jetbrains.uast.UField
import org.jetbrains.uast.UVariable
@KotlinCleanup("IDE Lint")
abstract class JavaFieldNamingPatternDetector : Detector(), Detector.UastScanner {
override fun createUastHandler(context: JavaContext): UElementHandler? {
return VariableNamingHandler(context)

View File

@ -14,6 +14,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.detector.api.*

View File

@ -15,6 +15,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.detector.api.*

View File

@ -14,6 +14,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.SdkConstants

View File

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.detector.api.Implementation

View File

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.client.api.UElementHandler

View File

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.detector.api.*

View File

@ -14,6 +14,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.rules
import com.android.tools.lint.client.api.UElementHandler

View File

@ -1,3 +1,4 @@
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.utils
import com.android.tools.lint.detector.api.Category
@ -7,7 +8,6 @@ import com.android.tools.lint.detector.api.Severity
/**
* Hold some constants applicable to all lint issues.
*/
@KotlinCleanup("IDE Lint")
object Constants {
/**
* A special [Category] which groups the Lint issues related to the usage of the new SystemTime class as a

View File

@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
@file:Suppress("UnstableApiUsage")
package com.ichi2.anki.lint.utils
import com.android.tools.lint.client.api.UElementHandler
@ -21,7 +22,6 @@ import com.android.tools.lint.detector.api.JavaContext
import org.jetbrains.uast.UElement
import org.jetbrains.uast.UImportStatement
@KotlinCleanup("IDE lint")
abstract class ImportStatementDetector : Detector() {
abstract fun visitImportStatement(context: JavaContext, node: UImportStatement)
override fun getApplicableUastTypes(): List<Class<out UElement?>>? {