checkstyle

Checkstyle plugin for danger-kotlin

License

License

Categories

Categories

Checkstyle Application Testing & Monitoring Code Analysis
GroupId

GroupId

co.uzzu.danger.plugins
ArtifactId

ArtifactId

checkstyle
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

checkstyle
Checkstyle plugin for danger-kotlin
Project URL

Project URL

https://github.com/uzzu/danger-checkstyle-plugin
Source Code Management

Source Code Management

https://github.com/uzzu/danger-checkstyle-plugin

Download checkstyle

Dependencies

compile (3)

Group / Artifact Type Version
org.dom4j : dom4j jar 2.1.3
jaxen : jaxen jar 1.1.6
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.4.0

runtime (1)

Group / Artifact Type Version
systems.danger : danger-kotlin-sdk jar 1.2

Project Modules

There are no modules declared in this project.

Coding Style Released Version

danger-checkstyle-plugin

A Danger Kotlin plugin for reporting checkstyle result.

Setup

  • 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
    
    // :

Examples

Simple use

@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")

Use with glob matcher

@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")

Use with configuration block

@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"
}

Configuration

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.

reporter

Determinate the reporting style. You can choose the following reporter.

Inline

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 }

Markdown

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" }

severities

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)

basePath

Determinate base of check style result file path. The working directory is used by default.

CheckStyle.basePath = "path/to/your/base/directory"

License

Apache 2.0 License

Versions

Version
0.2.0
0.1.0