This allows you to easily install and run diKTat in Kotlin projects.
name: Run diKTat
on:
push:
branches: [ main ]
jobs:
diktat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: marcospereira/kotlin-diktat-actionThe action accepts inputs based on what diKTat CLI supports, but filters out a few options.
The supported inputs are:
-
version: The diktat version to use.- Default:
2.0.0 - Examples:
version: "1.2.5"
- Default:
-
patterns: A list of files to process by diktat- Default: "src/main/kotlin"
- Examples:
patterns: "src/main/kotlin src/test/kotlin src/functionalTest/kotlin"
patterns: "src/**/*.kt"
-
config: specify the location of the YAML configuration file. By default, diktat-analysis.yml in the current directory is used- Default:
"diktat-analysis.yml" - Examples:
config: configs/diktat-analysis.yml
- Default:
-
reporter: The reporter to use to log errors to output. Value should be one ofcheckstyle,html,json,plain,plain_group_by_file,sarif- Default: empty, meaning it will use the CLI's default (
plain) - Examples:
reporter: "html" output: diktat-report.html
reporter: "sarif" output: diktat-report.sarif
[!IMPORTANT] When setting a
reporter, it is also required to setoutput, and diktat CLI fails if one is set but not the other.
- Default: empty, meaning it will use the CLI's default (
-
output: Redirect the reporter output to a file. Must be provided when the reporter is provided- Default: empty
- Examples: see
reporterexamples above.
-
group-by-file: A flag to group found errors by files- Default:
"false" - Examples:
group-by-file: true
- Default:
-
log-level: Control the log level. Value should be one oferror,warn,info,debug,trace- Default:
"info" - Examples:
log-level: "debug"
log-level: "error"
- Default:
name: Run diKTat
on:
push:
branches: [ main ]
jobs:
diktat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: marcospereira/kotlin-diktat-action
with:
patterns: "src/main/kotlin src/test/kotlin"
log-level: debug
group-by-file: true
reporter: sarif
output: diktat.sarif