-
-
Notifications
You must be signed in to change notification settings - Fork 755
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump ktlint to version 0.45.1 and implement new rules (#4645)
- Loading branch information
Showing
26 changed files
with
502 additions
and
61 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
22 changes: 0 additions & 22 deletions
22
...kt-formatting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/EditorConfigMerge.kt
This file was deleted.
Oops, something went wrong.
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
16 changes: 16 additions & 0 deletions
16
...otlin/io/gitlab/arturbosch/detekt/formatting/wrappers/BlockCommentInitialStarAlignment.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,16 @@ | ||
package io.gitlab.arturbosch.detekt.formatting.wrappers | ||
|
||
import com.pinterest.ktlint.ruleset.experimental.BlockCommentInitialStarAlignmentRule | ||
import io.gitlab.arturbosch.detekt.api.Config | ||
import io.gitlab.arturbosch.detekt.api.internal.AutoCorrectable | ||
import io.gitlab.arturbosch.detekt.formatting.FormattingRule | ||
|
||
/** | ||
* See <a href="https://ktlint.github.io/#rule-spacing">ktlint-website</a> for documentation. | ||
*/ | ||
@AutoCorrectable(since = "1.20.0") | ||
class BlockCommentInitialStarAlignment(config: Config) : FormattingRule(config) { | ||
|
||
override val wrapping = BlockCommentInitialStarAlignmentRule() | ||
override val issue = issueFor("Detect the alignment of the initial star in a block comment.") | ||
} |
30 changes: 30 additions & 0 deletions
30
...atting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/wrappers/CommentWrapping.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,30 @@ | ||
package io.gitlab.arturbosch.detekt.formatting.wrappers | ||
|
||
import com.pinterest.ktlint.core.api.DefaultEditorConfigProperties | ||
import com.pinterest.ktlint.core.api.FeatureInAlphaState | ||
import com.pinterest.ktlint.core.api.UsesEditorConfigProperties | ||
import com.pinterest.ktlint.ruleset.experimental.CommentWrappingRule | ||
import io.gitlab.arturbosch.detekt.api.Config | ||
import io.gitlab.arturbosch.detekt.api.config | ||
import io.gitlab.arturbosch.detekt.api.internal.AutoCorrectable | ||
import io.gitlab.arturbosch.detekt.api.internal.Configuration | ||
import io.gitlab.arturbosch.detekt.formatting.FormattingRule | ||
|
||
/** | ||
* See <a href="https://ktlint.github.io/#rule-indentation">ktlint-website</a> for documentation. | ||
*/ | ||
@AutoCorrectable(since = "1.20.0") | ||
class CommentWrapping(config: Config) : FormattingRule(config) { | ||
|
||
override val wrapping = CommentWrappingRule() | ||
override val issue = issueFor("Reports mis-indented code") | ||
|
||
@Configuration("indentation size") | ||
private val indentSize by config(4) | ||
|
||
@OptIn(FeatureInAlphaState::class) | ||
override fun overrideEditorConfigProperties(): Map<UsesEditorConfigProperties.EditorConfigProperty<*>, String> = | ||
mapOf( | ||
DefaultEditorConfigProperties.indentSizeProperty to indentSize.toString(), | ||
) | ||
} |
16 changes: 16 additions & 0 deletions
16
...main/kotlin/io/gitlab/arturbosch/detekt/formatting/wrappers/DiscouragedCommentLocation.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,16 @@ | ||
package io.gitlab.arturbosch.detekt.formatting.wrappers | ||
|
||
import com.pinterest.ktlint.ruleset.experimental.DiscouragedCommentLocationRule | ||
import io.gitlab.arturbosch.detekt.api.Config | ||
import io.gitlab.arturbosch.detekt.api.internal.AutoCorrectable | ||
import io.gitlab.arturbosch.detekt.formatting.FormattingRule | ||
|
||
/** | ||
* See <a href="https://ktlint.github.io/#rule-spacing">ktlint-website</a> for documentation. | ||
*/ | ||
@AutoCorrectable(since = "1.20.0") | ||
class DiscouragedCommentLocation(config: Config) : FormattingRule(config) { | ||
|
||
override val wrapping = DiscouragedCommentLocationRule() | ||
override val issue = issueFor("Detect discouraged comment locations.") | ||
} |
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
16 changes: 16 additions & 0 deletions
16
...ting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/wrappers/FunKeywordSpacing.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,16 @@ | ||
package io.gitlab.arturbosch.detekt.formatting.wrappers | ||
|
||
import com.pinterest.ktlint.ruleset.experimental.FunKeywordSpacingRule | ||
import io.gitlab.arturbosch.detekt.api.Config | ||
import io.gitlab.arturbosch.detekt.api.internal.AutoCorrectable | ||
import io.gitlab.arturbosch.detekt.formatting.FormattingRule | ||
|
||
/** | ||
* See <a href="https://ktlint.github.io/#rule-spacing">ktlint-website</a> for documentation. | ||
*/ | ||
@AutoCorrectable(since = "1.20.0") | ||
class FunKeywordSpacing(config: Config) : FormattingRule(config) { | ||
|
||
override val wrapping = FunKeywordSpacingRule() | ||
override val issue = issueFor("Checks the spacing after the fun keyword.") | ||
} |
17 changes: 17 additions & 0 deletions
17
...in/kotlin/io/gitlab/arturbosch/detekt/formatting/wrappers/FunctionTypeReferenceSpacing.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,17 @@ | ||
package io.gitlab.arturbosch.detekt.formatting.wrappers | ||
|
||
import com.pinterest.ktlint.ruleset.experimental.FunctionTypeReferenceSpacingRule | ||
import io.gitlab.arturbosch.detekt.api.Config | ||
import io.gitlab.arturbosch.detekt.api.internal.AutoCorrectable | ||
import io.gitlab.arturbosch.detekt.formatting.FormattingRule | ||
|
||
/** | ||
* See <a href="https://ktlint.github.io/#rule-spacing">ktlint-website</a> for documentation. | ||
*/ | ||
@AutoCorrectable(since = "1.20.0") | ||
class FunctionTypeReferenceSpacing(config: Config) : FormattingRule(config) { | ||
|
||
override val wrapping = FunctionTypeReferenceSpacingRule() | ||
override val issue = | ||
issueFor("Checks the spacing before and after the angle brackets of a type argument list.") | ||
} |
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
30 changes: 30 additions & 0 deletions
30
...ormatting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/wrappers/KdocWrapping.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,30 @@ | ||
package io.gitlab.arturbosch.detekt.formatting.wrappers | ||
|
||
import com.pinterest.ktlint.core.api.DefaultEditorConfigProperties | ||
import com.pinterest.ktlint.core.api.FeatureInAlphaState | ||
import com.pinterest.ktlint.core.api.UsesEditorConfigProperties | ||
import com.pinterest.ktlint.ruleset.experimental.KdocWrappingRule | ||
import io.gitlab.arturbosch.detekt.api.Config | ||
import io.gitlab.arturbosch.detekt.api.config | ||
import io.gitlab.arturbosch.detekt.api.internal.AutoCorrectable | ||
import io.gitlab.arturbosch.detekt.api.internal.Configuration | ||
import io.gitlab.arturbosch.detekt.formatting.FormattingRule | ||
|
||
/** | ||
* See <a href="https://ktlint.github.io/#rule-indentation">ktlint-website</a> for documentation. | ||
*/ | ||
@AutoCorrectable(since = "1.20.0") | ||
class KdocWrapping(config: Config) : FormattingRule(config) { | ||
|
||
override val wrapping = KdocWrappingRule() | ||
override val issue = issueFor("Reports mis-indented code") | ||
|
||
@Configuration("indentation size") | ||
private val indentSize by config(4) | ||
|
||
@OptIn(FeatureInAlphaState::class) | ||
override fun overrideEditorConfigProperties(): Map<UsesEditorConfigProperties.EditorConfigProperty<*>, String> = | ||
mapOf( | ||
DefaultEditorConfigProperties.indentSizeProperty 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
Oops, something went wrong.