@@ -27,6 +27,10 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) {
27
27
RulesConfig (WRONG_NEWLINES .name, true ,
28
28
mapOf (" maxCallsInOneLine" to " 1" ))
29
29
)
30
+ private val rulesConfigListLong: List <RulesConfig > = listOf (
31
+ RulesConfig (WRONG_NEWLINES .name, true ,
32
+ mapOf (" maxCallsInOneLine" to " 10" ))
33
+ )
30
34
private val ruleId = " $DIKTAT_RULE_SET_ID :${NewlinesRule .NAME_ID } "
31
35
private val dotQuaOrSafeAccessOrPostfixExpression = " ${WRONG_NEWLINES .warnText()} wrong split long `dot qualified expression` or `safe access expression`"
32
36
private val shouldBreakAfter = " ${WRONG_NEWLINES .warnText()} should break a line after and not before"
@@ -682,7 +686,8 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) {
682
686
| }
683
687
|}
684
688
""" .trimMargin(),
685
- DiktatError (19 , 20 , ruleId, " ${WRONG_NEWLINES .warnText()} should follow functional style at ." , true ),
689
+ DiktatError (16 , 9 , ruleId, dotQuaOrSafeAccessOrPostfixExpression, true ),
690
+ DiktatError (19 , 20 , ruleId, " $functionalStyleWarn ." , true ),
686
691
rulesConfigList = rulesConfigListShort
687
692
)
688
693
}
@@ -829,9 +834,9 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) {
829
834
|}
830
835
""" .trimMargin(),
831
836
DiktatError (2 , 4 , ruleId, dotQuaOrSafeAccessOrPostfixExpression, true ),
832
- DiktatError (3 , 22 , ruleId, " ${ WRONG_NEWLINES .warnText()} should follow functional style at ." , true ),
837
+ DiktatError (3 , 22 , ruleId, " $functionalStyleWarn ." , true ),
833
838
DiktatError (13 , 4 , ruleId, dotQuaOrSafeAccessOrPostfixExpression, true ),
834
- DiktatError (13 , 23 , ruleId, " ${ WRONG_NEWLINES .warnText()} should follow functional style at ." , true )
839
+ DiktatError (13 , 23 , ruleId, " $functionalStyleWarn ." , true )
835
840
)
836
841
}
837
842
@@ -893,7 +898,9 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) {
893
898
| .few()
894
899
|}
895
900
""" .trimMargin(),
901
+ DiktatError (2 , 4 , ruleId, dotQuaOrSafeAccessOrPostfixExpression, true ),
896
902
DiktatError (4 , 10 , ruleId, " $functionalStyleWarn ." , true ),
903
+ DiktatError (8 , 4 , ruleId, dotQuaOrSafeAccessOrPostfixExpression, true ),
897
904
DiktatError (9 , 11 , ruleId, " $functionalStyleWarn ." , true ),
898
905
DiktatError (9 , 17 , ruleId, " $functionalStyleWarn ." , true ),
899
906
rulesConfigList = rulesConfigListShort
@@ -930,7 +937,9 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) {
930
937
|}
931
938
""" .trimMargin(),
932
939
DiktatError (2 , 7 , ruleId, " $functionalStyleWarn ." , true ),
940
+ DiktatError (15 , 4 , ruleId, dotQuaOrSafeAccessOrPostfixExpression, true ),
933
941
DiktatError (16 , 10 , ruleId, " $functionalStyleWarn ." , true ),
942
+ DiktatError (21 , 4 , ruleId, dotQuaOrSafeAccessOrPostfixExpression, true ),
934
943
DiktatError (21 , 7 , ruleId, " $functionalStyleWarn ." , true ),
935
944
DiktatError (22 , 10 , ruleId, " $functionalStyleWarn ." , true ),
936
945
rulesConfigList = rulesConfigListShort
@@ -1051,6 +1060,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) {
1051
1060
""" .trimMargin(),
1052
1061
DiktatError (2 , 14 , ruleId, " $functionalStyleWarn ?:" , true ),
1053
1062
DiktatError (4 , 8 , ruleId, " $functionalStyleWarn ?:" , true ),
1063
+ DiktatError (4 , 11 , ruleId, dotQuaOrSafeAccessOrPostfixExpression, true ),
1054
1064
DiktatError (4 , 22 , ruleId, " $functionalStyleWarn ." , true ),
1055
1065
rulesConfigList = rulesConfigListShort
1056
1066
)
@@ -1066,7 +1076,9 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) {
1066
1076
| a().b.c()!!
1067
1077
|}
1068
1078
""" .trimMargin(),
1079
+ DiktatError (2 , 4 , ruleId, dotQuaOrSafeAccessOrPostfixExpression, true ),
1069
1080
DiktatError (2 , 11 , ruleId, " $functionalStyleWarn ." , true ),
1081
+ DiktatError (3 , 4 , ruleId, dotQuaOrSafeAccessOrPostfixExpression, true ),
1070
1082
DiktatError (3 , 9 , ruleId, " $functionalStyleWarn ." , true ),
1071
1083
rulesConfigList = rulesConfigListShort
1072
1084
)
@@ -1092,6 +1104,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) {
1092
1104
| .qwe()
1093
1105
|}
1094
1106
""" .trimMargin(),
1107
+ DiktatError (7 , 11 , ruleId, dotQuaOrSafeAccessOrPostfixExpression, true ),
1095
1108
DiktatError (7 , 22 , ruleId, " $functionalStyleWarn ." , true ),
1096
1109
DiktatError (9 , 15 , ruleId, " $functionalStyleWarn ?:" , true ),
1097
1110
DiktatError (10 , 16 , ruleId, " $functionalStyleWarn ?:" , true ),
@@ -1152,6 +1165,7 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) {
1152
1165
| if(a().b().c()) {}
1153
1166
|}
1154
1167
""" .trimMargin(),
1168
+ DiktatError (2 , 7 , ruleId, dotQuaOrSafeAccessOrPostfixExpression, true ),
1155
1169
DiktatError (2 , 14 , ruleId, " ${COMPLEX_EXPRESSION .warnText()} ." , false ),
1156
1170
DiktatError (2 , 14 , ruleId, " $functionalStyleWarn ." , true ),
1157
1171
rulesConfigList = rulesConfigListShort
@@ -1195,4 +1209,17 @@ class NewlinesRuleWarnTest : LintTestBase(::NewlinesRule) {
1195
1209
fileName = " build.gradle.kts"
1196
1210
)
1197
1211
}
1212
+
1213
+ @Test
1214
+ @Tags(Tag (WarningNames .WRONG_NEWLINES ), Tag (WarningNames .COMPLEX_EXPRESSION ))
1215
+ fun `shouldn't trigger on allowed many calls in one line` () {
1216
+ lintMethod(
1217
+ """
1218
+ |fun foo() {
1219
+ | if(a().b().c().d().e()) {}
1220
+ |}
1221
+ """ .trimMargin(),
1222
+ rulesConfigList = rulesConfigListLong
1223
+ )
1224
+ }
1198
1225
}
0 commit comments