-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Ahmed Tarek edited this page Feb 22, 2019
·
8 revisions
Two options:
Koshry has ready rules to apply on the git diff of your pull request:
- Use it when you want to apply a condition to all of the added and modified lines in the pull request.
- if the condition is met, Koshry will add a new issue to the report.
- The added issue contains the file path, line number, level of issue and the report title.
val rule = lineRule {
reportTitle = "Don't use android.util.Log, use our custom Logger"
issueLevel = WARN()
condition = { file , line -> line.text.contains("android.util.Log") }
}
- The generated issue will be like this screenshot:
- Use it when you want to apply a condition to all of the added and modified files in the pull request.
- if the condition is met, Koshry will add a new issue to the report.
- The added issue contains the file path, level of issue and the report title.
val rule = fileRule {
reportTitle = "Don't add new Java files, use Kotlin instead."
issueLevel = ERROR()
condition = { file ->
file.isAdded && file.name.endsWith(".java")
}
}
- Protect a list of files to be changed by any pull request author.
- Exclude some an author or more from this rule if you want.
val rule = protectedFileRule {
reportTitle = "Files are protected and can't be modified, ask @tarek360 to modify"
issueLevel = ERROR()
files {
filePath = "dependencies.kts"
filePath = ".circleci/config.yml"
}
excludeAuthors {
author = "tarek360"
}
}