A Danger Kotlin plugin for reporting checkstyle result.
- Install Danger Kotlin
- Add the following dependency in your
Dangerfile.df.kts
:@file:DependsOn("co.uzzu.danger.plugins:checkstyle:0.2.0")
- Register plugin and then write script to report your checkstyle result.
import co.uzzu.danger.plugins.checkstyle.CheckStyle import systems.danger.kotlin.Danger import systems.danger.kotlin.register register plugin CheckStyle // :
@file:DependsOn("co.uzzu.danger.plugins:checkstyle:0.2.0")
import co.uzzu.danger.plugins.checkstyle.CheckStyle
import systems.danger.kotlin.Danger
import systems.danger.kotlin.register
register plugin CheckStyle
val d = Danger(args)
CheckStyle.report("path/to/checkstyle_result.xml")
@file:DependsOn("co.uzzu.danger.plugins:checkstyle:0.2.0")
import co.uzzu.danger.plugins.checkstyle.CheckStyle
import systems.danger.kotlin.Danger
import systems.danger.kotlin.register
register plugin CheckStyle
val d = Danger(args)
CheckStyle.report("glob:**/path/to/*check_result.xml")
@file:DependsOn("co.uzzu.danger.plugins:checkstyle:0.2.0")
import co.uzzu.danger.plugins.checkstyle.CheckStyle
import systems.danger.kotlin.Danger
import systems.danger.kotlin.register
register plugin CheckStyle
val d = Danger(args)
CheckStyle.report {
// Set configuration properties
// :
// [Required] Set path to checkstyle result file.
path = "path/to/checkstyle_result.xml"
}
You can customize reporting styles as you needed by using configuration scope. The CheckStyle plugin object also has same properties, and these properties are used as default of configuration scope.
Determinate the reporting style. You can choose the following reporter.
Report as inline comment
You can choose reporting method MESSAGE
, WARN
, and FAIL
.
import co.uzzu.danger.plugins.checkstyle.Inline
import co.uzzu.danger.plugins.checkstyle.ReportMethod.*
CheckStyle.reporter = Inline // reporterMethod = ERROR is used by default.
CheckStyle.reporter = Inline { reportMethod = WARN }
Report as message with the Markdown format.
import co.uzzu.danger.plugins.checkstyle.Markdown
CheckStyle.reporter = Markdown // label = "Checkstyle" is used by default.
CheckStyle.reporter = Markdown { label = "My checkstyle" }
Determinate list of the checkstyle severities(ERROR
, IGNORE
, INFO
, WARNING
) to report.
Only ERROR
is reported by default.
import co.uzzu.danger.plugins.checkstyle.Severity.*
CheckStyle.severities = listOf(ERROR, IGNORE, INFO, WARNING)
Determinate base of check style result file path. The working directory is used by default.
CheckStyle.basePath = "path/to/your/base/directory"