Skip to content

Commit

Permalink
Fat-Jar version of detekt-generator module (#5297)
Browse files Browse the repository at this point in the history
* Make fat-jar version of detekt-generator

This will enable calls through CLI to generate configuration files for custom rules.

* Update docs on detekt-generator usage

* Update releasing.gradle.kts
  • Loading branch information
VitalyVPinchuk committed Sep 15, 2022
1 parent 15c19aa commit e02ac27
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions build-logic/src/main/kotlin/releasing.gradle.kts
Expand Up @@ -39,6 +39,7 @@ project.afterEvaluate {
cliBuildDir.resolve("libs/detekt-cli-${project.version}-all.jar"),
cliBuildDir.resolve("distributions/detekt-cli-${project.version}.zip"),
project(":detekt-formatting").buildDir.resolve("libs/detekt-formatting-${project.version}.jar"),
project(":detekt-generator").buildDir.resolve("libs/detekt-generator-${project.version}-all.jar"),
project(":detekt-rules-ruleauthors").buildDir
.resolve("libs/detekt-rules-ruleauthors-${project.version}.jar")
)
Expand Down
3 changes: 3 additions & 0 deletions detekt-generator/build.gradle.kts
@@ -1,7 +1,10 @@
plugins {
alias(libs.plugins.shadow)
id("module")
}

tasks.build { finalizedBy(tasks.shadowJar) }

dependencies {
implementation(projects.detektParser)
implementation(projects.detektApi)
Expand Down
10 changes: 10 additions & 0 deletions website/docs/gettingstarted/_cli-generator-options.md
@@ -0,0 +1,10 @@
```
Usage: java -jar detekt-generator-[detekt_version]-all.jar [options]
Options:
--generate-custom-rule-config, -gcrc
Generate custom rules configuration files. The files will be
placed under 'resources' folder of each rule respectively
(e.g. 'custom-rule/src/main/resources/config/config.yml').
--input, -i
Input paths to rules to analyze. Multiple paths are separated by comma.
```
9 changes: 9 additions & 0 deletions website/docs/gettingstarted/cli.mdx
Expand Up @@ -9,6 +9,7 @@ sidebar_position: 1
---

import CliOptions from "./_cli-options.md";
import CliGeneratorOptions from "./_cli-generator-options.md";

## Install the cli

Expand Down Expand Up @@ -50,3 +51,11 @@ detekt will exit with one of the following exit codes:
The following parameters are shown when `--help` is entered.

<CliOptions />

## Use the cli to generate configuration for custom rules

<CliGeneratorOptions />

```sh
java -jar detekt-generator-[detekt_version]-all.jar -gcrc -i /path/to/rule1, /path/to/rule2
```

0 comments on commit e02ac27

Please sign in to comment.