Skip to content

Commit c0cc087

Browse files
committed
Issue #101: activate CheckstyleRulesDefinitionTest.test()
1 parent 4417a85 commit c0cc087

File tree

2 files changed

+44
-9
lines changed

2 files changed

+44
-9
lines changed

checkstyle-sonar-plugin/src/main/resources/com/sonar/sqale/checkstyle-model.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,19 @@
487487
<txt>min</txt>
488488
</prop>
489489
</chc>
490+
<chc>
491+
<rule-repo>checkstyle</rule-repo>
492+
<rule-key>com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck</rule-key>
493+
<prop>
494+
<key>remediationFunction</key>
495+
<txt>CONSTANT_ISSUE</txt>
496+
</prop>
497+
<prop>
498+
<key>offset</key>
499+
<val>5</val>
500+
<txt>min</txt>
501+
</prop>
502+
</chc>
490503
<chc>
491504
<rule-repo>checkstyle</rule-repo>
492505
<rule-key>com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagContinuationIndentationCheck</rule-key>
@@ -946,6 +959,19 @@
946959
<txt>h</txt>
947960
</prop>
948961
</chc>
962+
<chc>
963+
<rule-repo>checkstyle</rule-repo>
964+
<rule-key>com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheck</rule-key>
965+
<prop>
966+
<key>remediationFunction</key>
967+
<txt>CONSTANT_ISSUE</txt>
968+
</prop>
969+
<prop>
970+
<key>offset</key>
971+
<val>1</val>
972+
<txt>h</txt>
973+
</prop>
974+
</chc>
949975
<chc>
950976
<rule-repo>checkstyle</rule-repo>
951977
<rule-key>com.puppycrawl.tools.checkstyle.checks.sizes.FileLengthCheck</rule-key>
@@ -998,6 +1024,19 @@
9981024
<txt>h</txt>
9991025
</prop>
10001026
</chc>
1027+
<chc>
1028+
<rule-repo>checkstyle</rule-repo>
1029+
<rule-key>com.puppycrawl.tools.checkstyle.checks.metrics.CyclomaticComplexityCheck</rule-key>
1030+
<prop>
1031+
<key>remediationFunction</key>
1032+
<txt>CONSTANT_ISSUE</txt>
1033+
</prop>
1034+
<prop>
1035+
<key>offset</key>
1036+
<val>3</val>
1037+
<txt>h</txt>
1038+
</prop>
1039+
</chc>
10011040
<chc>
10021041
<rule-repo>checkstyle</rule-repo>
10031042
<rule-key>com.puppycrawl.tools.checkstyle.checks.coding.IllegalTokenTextCheck</rule-key>

checkstyle-sonar-plugin/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
import java.util.List;
2525

26-
import org.junit.Ignore;
2726
import org.junit.Test;
2827
import org.sonar.api.server.rule.RulesDefinition;
2928

@@ -38,14 +37,15 @@ public class CheckstyleRulesDefinitionTest {
3837
"com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck",
3938
"com.puppycrawl.tools.checkstyle.checks.regexp.RegexpMultilineCheck",
4039
"com.puppycrawl.tools.checkstyle.checks.regexp.RegexpOnFilenameCheck",
41-
"com.puppycrawl.tools.checkstyle.checks.RegexpCheck",
40+
"com.puppycrawl.tools.checkstyle.checks.regexp.RegexpCheck",
4241
"com.puppycrawl.tools.checkstyle.checks.header.RegexpHeaderCheck",
4342
"com.puppycrawl.tools.checkstyle.checks.imports.ImportControlCheck",
44-
"com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck"
43+
"com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck",
44+
"com.puppycrawl.tools.checkstyle.checks.SuppressWarningsHolder",
45+
"com.puppycrawl.tools.checkstyle.checks.FileContentsHolder"
4546
);
4647

4748
@Test
48-
@Ignore
4949
public void test() {
5050
final CheckstyleRulesDefinition definition = new CheckstyleRulesDefinition();
5151
final RulesDefinition.Context context = new RulesDefinition.Context();
@@ -57,7 +57,7 @@ public void test() {
5757
assertThat(repository.language()).isEqualTo("java");
5858

5959
final List<RulesDefinition.Rule> rules = repository.rules();
60-
assertThat(rules).hasSize(150);
60+
assertThat(rules).hasSize(154);
6161

6262
for (RulesDefinition.Rule rule : rules) {
6363
assertThat(rule.key()).isNotNull();
@@ -76,15 +76,11 @@ public void test() {
7676
if (NO_SQALE.contains(rule.key())) {
7777
assertThat(rule.debtRemediationFunction()).overridingErrorMessage(
7878
"Sqale remediation function is set for rule '" + rule.key()).isNull();
79-
assertThat(rule.debtSubCharacteristic()).overridingErrorMessage(
80-
"Sqale characteristic is set for rule '" + rule.key()).isNull();
8179
}
8280
else {
8381
assertThat(rule.debtRemediationFunction()).overridingErrorMessage(
8482
"Sqale remediation function is not set for rule '" + rule.key())
8583
.isNotNull();
86-
assertThat(rule.debtSubCharacteristic()).overridingErrorMessage(
87-
"Sqale characteristic is not set for rule '" + rule.key()).isNotNull();
8884
}
8985
}
9086
}

0 commit comments

Comments
 (0)