Skip to content

Commit

Permalink
Deprecate OptionalWhenBraces rule (#6314)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicola Corti <corti.nico@gmail.com>
  • Loading branch information
mdemianova and cortinico committed Jul 29, 2023
1 parent 2865763 commit fa788eb
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 3 deletions.
2 changes: 0 additions & 2 deletions detekt-core/src/main/resources/default-detekt-config.yml
Expand Up @@ -662,8 +662,6 @@ style:
active: true
OptionalUnit:
active: false
OptionalWhenBraces:
active: false
PreferToOverPairSyntax:
active: false
ProtectedMemberInFinalClass:
Expand Down
1 change: 1 addition & 0 deletions detekt-core/src/main/resources/deprecation.properties
Expand Up @@ -22,6 +22,7 @@ style>FunctionOnlyReturningConstant>excludeAnnotatedFunction=Use `ignoreAnnotate
style>LibraryCodeMustSpecifyReturnType=Rule migrated to `libraries` ruleset plugin
style>LibraryEntitiesShouldNotBePublic=Rule migrated to `libraries` ruleset plugin
style>MandatoryBracesIfStatements=Use `BracesOnIfStatements` with `always` configuration instead
style>OptionalWhenBraces=Same functionality is implemented in BracesOnWhenStatements
style>UnderscoresInNumericLiterals>acceptableDecimalLength=Use `acceptableLength` instead
style>UnnecessaryAbstractClass>excludeAnnotatedClasses=Use `ignoreAnnotated` instead
style>UseDataClass>excludeAnnotatedClasses=Use `ignoreAnnotated` instead
Expand Up @@ -33,6 +33,7 @@ import org.jetbrains.kotlin.psi.psiUtil.allChildren
* }
* </compliant>
*/
@Deprecated("Same functionality is implemented in BracesOnWhenStatements")
class OptionalWhenBraces(config: Config = Config.empty) : Rule(config) {

override val issue: Issue = Issue(
Expand Down
Expand Up @@ -19,7 +19,7 @@ class StyleGuideProvider : DefaultRuleSetProvider {

override val ruleSetId: String = "style"

@Suppress("LongMethod")
@Suppress("LongMethod", "DEPRECATION")
override fun instance(config: Config): RuleSet = RuleSet(
ruleSetId,
listOf(
Expand Down
Expand Up @@ -7,6 +7,7 @@ import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test

class OptionalWhenBracesSpec {
@Suppress("DEPRECATION")
val subject = OptionalWhenBraces()

@Test
Expand Down

0 comments on commit fa788eb

Please sign in to comment.