Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate continuationIndentSize from the Indentation rule #4551

Merged
merged 3 commits into from Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions detekt-core/src/main/resources/deprecation.properties
Expand Up @@ -7,3 +7,4 @@ style>FunctionOnlyReturningConstant>excludeAnnotatedFunction=Use `ignoreAnnotate
style>UnderscoresInNumericLiterals>acceptableDecimalLength=Use `acceptableLength` instead
style>UnnecessaryAbstractClass>excludeAnnotatedClasses=Use `ignoreAnnotated` instead
style>UseDataClass>excludeAnnotatedClasses=Use `ignoreAnnotated` instead
formatting>Indentation>continuationIndentSize=`continuationIndentSize` is ignored by KtLint and will have no effect
@@ -1,14 +1,12 @@
package io.gitlab.arturbosch.detekt.formatting

const val INDENT_SIZE_KEY = "indent_size"
const val CONTINUATION_INDENT_SIZE_KEY = "continuation_indent_size"
const val MAX_LINE_LENGTH_KEY = "max_line_length"
const val INSERT_FINAL_NEWLINE_KEY = "insert_final_newline"
const val KOTLIN_IMPORTS_LAYOUT_KEY = "kotlin_imports_layout"

val knownEditorConfigProps = setOf(
INDENT_SIZE_KEY,
CONTINUATION_INDENT_SIZE_KEY,
MAX_LINE_LENGTH_KEY,
INSERT_FINAL_NEWLINE_KEY,
KOTLIN_IMPORTS_LAYOUT_KEY
Expand Down
Expand Up @@ -7,7 +7,6 @@ import io.gitlab.arturbosch.detekt.api.config
import io.gitlab.arturbosch.detekt.api.internal.ActiveByDefault
import io.gitlab.arturbosch.detekt.api.internal.AutoCorrectable
import io.gitlab.arturbosch.detekt.api.internal.Configuration
import io.gitlab.arturbosch.detekt.formatting.CONTINUATION_INDENT_SIZE_KEY
import io.gitlab.arturbosch.detekt.formatting.FormattingRule
import io.gitlab.arturbosch.detekt.formatting.INDENT_SIZE_KEY
import org.jetbrains.kotlin.com.intellij.lang.ASTNode
Expand All @@ -26,11 +25,12 @@ class Indentation(config: Config) : FormattingRule(config) {
private val indentSize by config(4)

@Configuration("continuation indentation size")
@Deprecated("`continuationIndentSize` is ignored by KtLint and will have no effect")
@Suppress("UnusedPrivateMember")
private val continuationIndentSize by config(4)

override fun overrideEditorConfig() = mapOf(
INDENT_SIZE_KEY to indentSize,
CONTINUATION_INDENT_SIZE_KEY to continuationIndentSize
)

/**
Expand Down
1 change: 0 additions & 1 deletion detekt-formatting/src/main/resources/config/config.yml
Expand Up @@ -36,7 +36,6 @@ formatting:
active: true
autoCorrect: true
indentSize: 4
continuationIndentSize: 4
MaximumLineLength:
active: true
maxLineLength: 120
Expand Down
Expand Up @@ -27,7 +27,9 @@ class DetektPrinter(private val arguments: GeneratorArgs) {
ConfigPrinter.print(pages.filterNot { it.ruleSet.name == "formatting" })
}
propertiesWriter.write(arguments.configPath, "deprecation") {
DeprecatedPrinter.print(pages.filterNot { it.ruleSet.name == "formatting" })
// We intentionally not filter for "formatting" as we want to be able to deprecate
// properties from that ruleset as well.
DeprecatedPrinter.print(pages)
}
yamlWriter.write(Paths.get("../detekt-formatting/src/main/resources/config"), "config") {
yaml {
Expand Down