Skip to content

Commit

Permalink
Remove --print-ast CLI flag as PsiViewer provides the same features (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
schalkms committed Oct 20, 2022
1 parent 8d20a5a commit 5c7f6ec
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 98 deletions.
6 changes: 2 additions & 4 deletions .github/CONTRIBUTING.md
Expand Up @@ -25,10 +25,8 @@ When implementing a new rule, do not forget to perform the following steps:
- Run `./gradlew generateDocumentation` to add your rule and its config options to the `default-detekt-config.yml`.
- Run `./gradlew build`. This will execute tests locally.

The following remarks might help you during the implementation:
- To print the AST of sources, you can pass the `--print-ast` flag to the CLI. This will print each
Kotlin files AST. This can be helpful when implementing and debugging rules.
- To view the AST (PSI) of your source code, you can use the [PSI Viewer plugin](https://plugins.jetbrains.com/plugin/227-psiviewer) for IntelliJ.
To view the AST (PSI) of your source code, you can use the [PSI Viewer plugin](https://plugins.jetbrains.com/plugin/227-psiviewer) for IntelliJ.
This can be helpful when implementing and debugging rules.

The general policy regarding contributed rules is as follows:
- PRs will stay open for at least two days so that other users can give feedback.
Expand Down
Expand Up @@ -149,13 +149,6 @@ class CliArgs {
)
var runRule: String? = null

@Parameter(
names = ["--print-ast"],
description = "Prints the AST for given [input] file. Must be no directory.",
hidden = true
)
var printAst: Boolean = false

/*
The following @Parameters are used for type resolution. When additional parameters are required the
names should mirror the names found in this file (e.g. "classpath", "language-version", "jvm-target"):
Expand Down
Expand Up @@ -5,7 +5,6 @@ import io.github.detekt.tooling.api.DetektCli
import io.github.detekt.tooling.api.UnexpectedError
import io.github.detekt.tooling.internal.DefaultAnalysisResult
import io.github.detekt.tooling.internal.EmptyContainer
import io.gitlab.arturbosch.detekt.cli.runners.AstPrinter
import io.gitlab.arturbosch.detekt.cli.runners.ConfigExporter
import io.gitlab.arturbosch.detekt.cli.runners.Runner
import io.gitlab.arturbosch.detekt.cli.runners.VersionPrinter
Expand All @@ -21,7 +20,6 @@ class CliRunner : DetektCli {
val specialRunner = when {
arguments.showVersion -> VersionPrinter(outputChannel)
arguments.generateConfig -> ConfigExporter(arguments, outputChannel)
arguments.printAst -> AstPrinter(arguments, outputChannel)
else -> null
}

Expand Down
Expand Up @@ -7,7 +7,6 @@ import io.github.detekt.tooling.api.MaxIssuesReached
import io.github.detekt.tooling.api.UnexpectedError
import io.github.detekt.tooling.api.exitCode
import io.github.detekt.tooling.internal.NotApiButProbablyUsedByUsers
import io.gitlab.arturbosch.detekt.cli.runners.AstPrinter
import io.gitlab.arturbosch.detekt.cli.runners.ConfigExporter
import io.gitlab.arturbosch.detekt.cli.runners.Executable
import io.gitlab.arturbosch.detekt.cli.runners.Runner
Expand Down Expand Up @@ -55,7 +54,6 @@ fun buildRunner(
return when {
arguments.showVersion -> VersionPrinter(outputPrinter)
arguments.generateConfig -> ConfigExporter(arguments, outputPrinter)
arguments.printAst -> AstPrinter(arguments, outputPrinter)
else -> Runner(arguments, outputPrinter, errorPrinter)
}
}

This file was deleted.

Expand Up @@ -5,7 +5,6 @@ package io.gitlab.arturbosch.detekt.cli
import io.github.detekt.test.utils.NullPrintStream
import io.github.detekt.test.utils.StringPrintStream
import io.github.detekt.test.utils.resourceAsPath
import io.gitlab.arturbosch.detekt.cli.runners.AstPrinter
import io.gitlab.arturbosch.detekt.cli.runners.ConfigExporter
import io.gitlab.arturbosch.detekt.cli.runners.Runner
import io.gitlab.arturbosch.detekt.cli.runners.VersionPrinter
Expand All @@ -28,7 +27,6 @@ class MainSpec {
return listOf(
arguments(arrayOf("--generate-config"), ConfigExporter::class),
arguments(arrayOf("--run-rule", "RuleSet:Rule"), Runner::class),
arguments(arrayOf("--print-ast"), AstPrinter::class),
arguments(arrayOf("--version"), VersionPrinter::class),
arguments(emptyArray<String>(), Runner::class),
)
Expand Down

This file was deleted.

0 comments on commit 5c7f6ec

Please sign in to comment.