File tree 2 files changed +6
-6
lines changed
main/kotlin/com/github/ivy/explicit/rule
test/kotlin/com/github/ivy/explicit/rule
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ class DataClassFunctionsRule(config: Config) : Rule(config) {
11
11
override val issue = Issue (
12
12
id = " DataClassFunctions" ,
13
13
severity = Severity .Maintainability ,
14
- description = " Data classes should not define behavior. " +
15
- " Their purpose is to model data." ,
14
+ description = " Data classes should not be tied to any behavior. " +
15
+ " Their responsibility is to solely model data." ,
16
16
debt = Debt .TWENTY_MINS ,
17
17
)
18
18
@@ -42,7 +42,7 @@ class DataClassFunctionsRule(config: Config) : Rule(config) {
42
42
function : KtNamedFunction
43
43
): String = buildString {
44
44
append(" Data class '${klass.name} ' should not contain functions. " )
45
- append(" Data classes should only model data and not define behavior . " )
46
- append(" Found: function ' ${ Message .functionSignature(function)} ' ." )
45
+ append(" Found: function ' ${ Message .functionSignature(function)} ' . " )
46
+ append(" Data classes should only model data and should not be tied to any behavior ." )
47
47
}
48
48
}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ internal class DataClassFunctionsRuleTest(private val env: KotlinCoreEnvironment
14
14
@Test
15
15
fun `reports data class having one function` () {
16
16
val code = """
17
- data class A (
17
+ data class Abc (
18
18
val x: Int
19
19
) {
20
20
fun a() = 42
@@ -24,7 +24,7 @@ internal class DataClassFunctionsRuleTest(private val env: KotlinCoreEnvironment
24
24
findings shouldHaveSize 1
25
25
val message = findings.first().message
26
26
message shouldBe """
27
- Data class 'A ' should not contain functions. Data classes should only model data and not define behavior. Found: function 'a()' .
27
+ Data class 'Abc ' should not contain functions. Found: function 'a()'. Data classes should only model data and should not be tied to any behavior .
28
28
""" .trimIndent()
29
29
}
30
30
You can’t perform that action at this time.
0 commit comments