Last active
June 6, 2020 11:01
-
-
Save guilhermekrz/caae10e098b0e078d8dde01c93d55fb0 to your computer and use it in GitHub Desktop.
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
class TooManyParametersDetector : Detector(), SourceCodeScanner { | |
private fun reportUsage(context: JavaContext, location: Location) { | |
context.report( | |
issue = ISSUE, | |
location = location, | |
message = "Method should not declare more than 5 parameters" | |
) | |
} | |
companion object { | |
private val IMPLEMENTATION = Implementation( | |
TooManyParametersDetector::class.java, | |
Scope.JAVA_FILE_SCOPE | |
) | |
val ISSUE: Issue = Issue.create( | |
id = "TooManyParametersDetector", | |
briefDescription = "Method should not declare more than 5 parameters", | |
explanation = """ | |
You should limit the number of parameters you method receive, | |
in order to make your method more legible and easier to use correctly. | |
""".trimIndent(), | |
category = Category.CORRECTNESS, | |
priority = 5, | |
severity = Severity.WARNING, | |
androidSpecific = true, | |
implementation = IMPLEMENTATION | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment