45 lines
2.1 KiB
Markdown
Executable file
45 lines
2.1 KiB
Markdown
Executable file
# [bld](https://rife2.com/bld) Extension to Perform Static Code Analysis with [Detekt](https://detekt.dev/) for [Kotlin](https://kotlinlang.org/)
|
|
|
|
|
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
|
[](https://rife2.com/bld)
|
|
[](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-detekt)
|
|
[](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-detekt)
|
|
[](https://github.com/rife2/bld-detekt/actions/workflows/bld.yml)
|
|
|
|
To install, please refer to the [extensions documentation](https://github.com/rife2/bld/wiki/Extensions).
|
|
|
|
To check all Kotlin source code located `src/main/kotlin` and `src/test/kotlin`, add the following to your build file
|
|
|
|
```java
|
|
@BuildCommand(summary = "Check source with Detekt")
|
|
public void detekt() throws ExitStatusException, IOException, InterruptedException {
|
|
new DetektOperation()
|
|
.fromProject(this)
|
|
.execute();
|
|
}
|
|
```
|
|
|
|
```console
|
|
./bld compile detekt
|
|
```
|
|
|
|
To generate a Detekt baseline, add the following to your build file:
|
|
|
|
```java
|
|
@BuildCommand(value = "detekt-baseline", summary = "Creates a Detekt baseline")
|
|
public void detektBaseline() throws ExitStatusException, IOException, InterruptedException {
|
|
new DetektOperation()
|
|
.fromProject(this)
|
|
.baseline("detekt-baseline.xml")
|
|
.createBaseline(true)
|
|
.execute();
|
|
}
|
|
```
|
|
|
|
```console
|
|
./bld compile detekt-baseline
|
|
```
|
|
|
|
Please check the [DetektOperation documentation](https://rife2.github.io/bld-detekt/rife/bld/extension/DetektOperation.html#method-summary) for all available configuration options.
|