Skip to content

Commit

Permalink
Run all rules from EmptyBlocks multi rule individually (#5208)
Browse files Browse the repository at this point in the history
Co-authored-by: Markus Schwarz <post@markus-schwarz.net>
  • Loading branch information
marschwar and Markus Schwarz committed Aug 16, 2022
1 parent 1a6a82d commit 30ffdc1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 234 deletions.

This file was deleted.

Expand Up @@ -17,7 +17,21 @@ class EmptyCodeProvider : DefaultRuleSetProvider {
override fun instance(config: Config): RuleSet = RuleSet(
ruleSetId,
listOf(
EmptyBlocks(config)
EmptyCatchBlock(config),
EmptyClassBlock(config),
EmptyDefaultConstructor(config),
EmptyDoWhileBlock(config),
EmptyElseBlock(config),
EmptyFinallyBlock(config),
EmptyForBlock(config),
EmptyFunctionBlock(config),
EmptyIfBlock(config),
EmptyInitBlock(config),
EmptyKtFile(config),
EmptySecondaryConstructor(config),
EmptyTryBlock(config),
EmptyWhenBlock(config),
EmptyWhileBlock(config),
)
)
}

This file was deleted.

Expand Up @@ -130,6 +130,12 @@ class EmptyCodeSpec {
test { EmptySecondaryConstructor(Config.empty) }
}

@Test
fun `reports an empty kt file`() {
val rule = EmptyKtFile(Config.empty)
assertThat(rule.compileAndLint("")).hasSize(1)
}

@Test
fun `doesNotFailWithInvalidRegexWhenDisabled`() {
val configValues = mapOf(
Expand Down
30 changes: 0 additions & 30 deletions detekt-rules-empty/src/test/resources/deactivated-empty-blocks.yml

This file was deleted.

0 comments on commit 30ffdc1

Please sign in to comment.