Skip to content

Instantly share code, notes, and snippets.

@guilhermekrz
Last active June 6, 2020 11:01
Show Gist options
  • Save guilhermekrz/caae10e098b0e078d8dde01c93d55fb0 to your computer and use it in GitHub Desktop.
Save guilhermekrz/caae10e098b0e078d8dde01c93d55fb0 to your computer and use it in GitHub Desktop.
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