Last active
June 2, 2020 00:24
-
-
Save guilhermekrz/79a2b0b99e2dc254e2c299f7d05f89a5 to your computer and use it in GitHub Desktop.
KotlinShouldNotThrowExceptionsDetector Issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val IMPLEMENTATION = Implementation( | |
KotlinShouldNotThrowExceptionsDetector::class.java, | |
Scope.JAVA_FILE_SCOPE | |
) | |
val ISSUE: Issue = Issue.create( | |
id = "KotlinShouldNotThrowExceptionsDetector", | |
briefDescription = "Kotlin code should not throw Exceptions", | |
explanation = """ | |
Kotlin does not support checked Exceptions, so we should not rely on Exceptions to propagate errors in our application. | |
More details in: https://kotlinlang.org/docs/reference/exceptions.html | |
""".trimIndent(), | |
category = Category.CORRECTNESS, | |
priority = 9, | |
severity = Severity.ERROR, | |
androidSpecific = true, | |
implementation = IMPLEMENTATION | |
) | |
fun reportUsage(context: JavaContext, location: Location) { | |
context.report( | |
issue = ISSUE, | |
location = location, | |
message = "Kotlin code should not throw Exceptions" | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment