Skip to content

Commit

Permalink
Deprecate continuationIndentSize from the Indentation rule (#4551)
Browse files Browse the repository at this point in the history
  • Loading branch information
cortinico committed Feb 4, 2022
1 parent ce9d5d7 commit da062f9
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
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

0 comments on commit da062f9

Please sign in to comment.