mirror of
https://github.com/jlengrand/detekt.git
synced 2026-03-10 08:11:23 +00:00
Fix false positive for value classes in ModifierOrder (#3719)
This commit is contained in:
@@ -219,6 +219,7 @@ If you contributed to detekt but your name is not in the list, please feel free
|
||||
- [Krzysztof Kruczynski](https://github.com/krzykrucz) - Rule fix: ThrowingExceptionInMain, ExitOutsideMain
|
||||
- [Paya Do](https://github.com/payathedo) - Designer for Detekt's logo
|
||||
- [zmunm](https://github.com/zmunm) - New rule: ObjectLiteralToLambda
|
||||
- [Eliezer Graber](https://github.com/eygraber) - Rule fix: ModifierOrder
|
||||
|
||||
### Mentions
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.lexer.KtTokens.PUBLIC_KEYWORD
|
||||
import org.jetbrains.kotlin.lexer.KtTokens.SEALED_KEYWORD
|
||||
import org.jetbrains.kotlin.lexer.KtTokens.SUSPEND_KEYWORD
|
||||
import org.jetbrains.kotlin.lexer.KtTokens.TAILREC_KEYWORD
|
||||
import org.jetbrains.kotlin.lexer.KtTokens.VALUE_KEYWORD
|
||||
import org.jetbrains.kotlin.lexer.KtTokens.VARARG_KEYWORD
|
||||
import org.jetbrains.kotlin.psi.KtModifierList
|
||||
import org.jetbrains.kotlin.psi.psiUtil.allChildren
|
||||
@@ -75,6 +76,7 @@ class ModifierOrder(config: Config = Config.empty) : Rule(config) {
|
||||
ENUM_KEYWORD, ANNOTATION_KEYWORD, FUN_KEYWORD,
|
||||
COMPANION_KEYWORD,
|
||||
INLINE_KEYWORD,
|
||||
VALUE_KEYWORD,
|
||||
INFIX_KEYWORD,
|
||||
OPERATOR_KEYWORD,
|
||||
DATA_KEYWORD
|
||||
|
||||
@@ -121,5 +121,16 @@ class ModifierOrderSpec : Spek({
|
||||
assertThat(subject.compileAndLint(code)).isEmpty()
|
||||
}
|
||||
}
|
||||
|
||||
context("value class") {
|
||||
|
||||
it("should not report correctly ordered modifiers") {
|
||||
val code = """
|
||||
@JvmInline
|
||||
private value class Foo(val bar: Int)
|
||||
"""
|
||||
assertThat(subject.compileAndLint(code)).isEmpty()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user