Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update ktlint to v0.48.0 * Update imports for ktlint 0.48.0 * Update finding locations for ktlint 0.48.0 * Disable ktlint's NoSemicolons rule This can be enabled again when this defect is fixed: pinterest/ktlint#1733 * Fix new indentation issues raised by ktlint 0.48.0 * Add ContextReceiverMapping rule * Enable ContextReceiverMapping rule on detekt codebase * Fix deprecation warnings
- Loading branch information
Showing
24 changed files
with
115 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/wrappers/ContextReceiverMapping.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.gitlab.arturbosch.detekt.formatting.wrappers | ||
|
||
import com.pinterest.ktlint.core.api.editorconfig.EditorConfigProperty | ||
import com.pinterest.ktlint.core.api.editorconfig.INDENT_SIZE_PROPERTY | ||
import com.pinterest.ktlint.core.api.editorconfig.MAX_LINE_LENGTH_PROPERTY | ||
import com.pinterest.ktlint.ruleset.experimental.ContextReceiverWrappingRule | ||
import io.gitlab.arturbosch.detekt.api.Config | ||
import io.gitlab.arturbosch.detekt.api.config | ||
import io.gitlab.arturbosch.detekt.api.configWithAndroidVariants | ||
import io.gitlab.arturbosch.detekt.api.internal.AutoCorrectable | ||
import io.gitlab.arturbosch.detekt.api.internal.Configuration | ||
import io.gitlab.arturbosch.detekt.formatting.FormattingRule | ||
|
||
/** | ||
* See [ktlint docs](https://pinterest.github.io/ktlint/rules/experimental/#content-receiver-wrapping) for documentation. | ||
*/ | ||
@AutoCorrectable(since = "1.23.0") | ||
class ContextReceiverMapping(config: Config) : FormattingRule(config) { | ||
|
||
override val wrapping = ContextReceiverWrappingRule() | ||
override val issue = issueFor("Reports mis-indented code") | ||
|
||
@Configuration("maximum line length") | ||
private val maxLineLength: Int by configWithAndroidVariants(120, 100) | ||
|
||
@Configuration("indentation size") | ||
private val indentSize by config(4) | ||
|
||
override fun overrideEditorConfigProperties(): Map<EditorConfigProperty<*>, String> = | ||
mapOf( | ||
MAX_LINE_LENGTH_PROPERTY to maxLineLength.toString(), | ||
INDENT_SIZE_PROPERTY to indentSize.toString(), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.