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

refactor: Convert Constants to Kotlin

com.ichi2.anki.lint.utils.Constants
This commit is contained in:
David Allison 2022-05-10 23:12:46 +01:00 committed by Mike Hardy
parent 966b0142c1
commit 9ae744759a
3 changed files with 36 additions and 32 deletions

View File

@ -43,7 +43,7 @@ permission notice:
// Example of class name: "/com/ichi2/anki/UIUtils.kt"
// Ensure that it starts with '/' (slash)
def source = Source.MAIN
def className = "/com/ichi2/anki/lint/utils/Constants.kt"
def className = ""
enum Source {
MAIN("/src/main/java"),

View File

@ -24,7 +24,9 @@ import com.android.tools.lint.detector.api.ResourceXmlDetector
import com.android.tools.lint.detector.api.Scope.Companion.ALL_RESOURCES_SCOPE
import com.android.tools.lint.detector.api.XmlContext
import com.android.utils.forEach
import com.ichi2.anki.lint.utils.Constants.*
import com.ichi2.anki.lint.utils.Constants.ANKI_XML_CATEGORY
import com.ichi2.anki.lint.utils.Constants.ANKI_XML_PRIORITY
import com.ichi2.anki.lint.utils.Constants.ANKI_XML_SEVERITY
import com.ichi2.anki.lint.utils.StringFormatDetector
import org.w3c.dom.Element
import org.w3c.dom.Node

View File

@ -1,78 +1,80 @@
package com.ichi2.anki.lint.utils;
package com.ichi2.anki.lint.utils
import com.android.tools.lint.detector.api.Category;
import com.android.tools.lint.detector.api.Severity;
import static com.android.tools.lint.detector.api.Category.create;
import com.android.tools.lint.detector.api.Category
import com.android.tools.lint.detector.api.Category.Companion.create
import com.android.tools.lint.detector.api.Severity
/**
* Hold some constants applicable to all lint issues.
*/
public class Constants {
@KotlinCleanup("IDE Lint")
object Constants {
/**
* A special {@link Category} which groups the Lint issues related to the usage of the new SystemTime class as a
* sub category for {@link Category#CORRECTNESS}.
* A special [Category] which groups the Lint issues related to the usage of the new SystemTime class as a
* sub category for [Category.CORRECTNESS].
*/
public static final Category ANKI_TIME_CATEGORY = create(Category.CORRECTNESS, "AnkiTime", 10);
@JvmField
val ANKI_TIME_CATEGORY: Category = create(Category.CORRECTNESS, "AnkiTime", 10)
/**
* The priority for the Lint issues used by all rules related to the restrictions introduced by SystemTime.
*/
public static final int ANKI_TIME_PRIORITY = 10;
const val ANKI_TIME_PRIORITY = 10
/**
* The severity for the Lint issues used by all rules related to the restrictions introduced by SystemTime.
*/
public static final Severity ANKI_TIME_SEVERITY = Severity.FATAL;
@JvmField
val ANKI_TIME_SEVERITY = Severity.FATAL
/**
* The priority for the Lint issues used by all rules related to the restrictions introduced by SystemTime.
*/
public static final int ANKI_CROWDIN_PRIORITY = 10;
const val ANKI_CROWDIN_PRIORITY = 10
/**
* A special {@link Category} which groups the Lint issues related to the usage of CrowdIn as a
* sub category for {@link Category#CORRECTNESS}.
* A special [Category] which groups the Lint issues related to the usage of CrowdIn as a
* sub category for [Category.CORRECTNESS].
*/
public static final Category ANKI_CROWDIN_CATEGORY = create(Category.CORRECTNESS, "AnkiCrowdIn", ANKI_CROWDIN_PRIORITY);
val ANKI_CROWDIN_CATEGORY: Category =
create(Category.CORRECTNESS, "AnkiCrowdIn", ANKI_CROWDIN_PRIORITY)
/**
* The severity for the Lint issues used by all rules related to CrowdIn restrictions.
*/
public static final Severity ANKI_CROWDIN_SEVERITY = Severity.FATAL;
val ANKI_CROWDIN_SEVERITY = Severity.FATAL
/**
* A special {@link Category} which groups the Lint issues related to Code Style as a
* sub category for {@link Category#COMPLIANCE}.
* A special [Category] which groups the Lint issues related to Code Style as a
* sub category for [Category.COMPLIANCE].
*/
public static final Category ANKI_CODE_STYLE_CATEGORY = create(Category.COMPLIANCE, "CodeStyle", 10);
@JvmField
val ANKI_CODE_STYLE_CATEGORY: Category = create(Category.COMPLIANCE, "CodeStyle", 10)
/**
* The priority for the Lint issues used by rules related to Code Style.
*/
public static final int ANKI_CODE_STYLE_PRIORITY = 10;
const val ANKI_CODE_STYLE_PRIORITY = 10
/**
* The severity for the Lint issues used by rules related to Code Style.
*/
public static final Severity ANKI_CODE_STYLE_SEVERITY = Severity.FATAL;
@JvmField
val ANKI_CODE_STYLE_SEVERITY = Severity.FATAL
/**
* A special {@link Category} which groups the Lint issues related to XML as a
* sub category for {@link Category#CORRECTNESS}.
* A special [Category] which groups the Lint issues related to XML as a
* sub category for [Category.CORRECTNESS].
*/
public static final Category ANKI_XML_CATEGORY = create(Category.CORRECTNESS, "XML", 10);
val ANKI_XML_CATEGORY: Category = create(Category.CORRECTNESS, "XML", 10)
/**
* The priority for the Lint issues used by rules related to XML.
*/
public static final int ANKI_XML_PRIORITY = 10;
const val ANKI_XML_PRIORITY = 10
/**
* The severity for the Lint issues used by rules related to XML.
*/
public static final Severity ANKI_XML_SEVERITY = Severity.FATAL;
}
val ANKI_XML_SEVERITY = Severity.FATAL
}