Skip to content

Commit

Permalink
Issue #101: activate CheckstyleRulesDefinitionTest.test()
Browse files Browse the repository at this point in the history
  • Loading branch information
romani committed Apr 30, 2017
1 parent 4417a85 commit c0cc087
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,19 @@
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck</rule-key>
<prop>
<key>remediationFunction</key>
<txt>CONSTANT_ISSUE</txt>
</prop>
<prop>
<key>offset</key>
<val>5</val>
<txt>min</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagContinuationIndentationCheck</rule-key>
Expand Down Expand Up @@ -946,6 +959,19 @@
<txt>h</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheck</rule-key>
<prop>
<key>remediationFunction</key>
<txt>CONSTANT_ISSUE</txt>
</prop>
<prop>
<key>offset</key>
<val>1</val>
<txt>h</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.sizes.FileLengthCheck</rule-key>
Expand Down Expand Up @@ -998,6 +1024,19 @@
<txt>h</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.metrics.CyclomaticComplexityCheck</rule-key>
<prop>
<key>remediationFunction</key>
<txt>CONSTANT_ISSUE</txt>
</prop>
<prop>
<key>offset</key>
<val>3</val>
<txt>h</txt>
</prop>
</chc>
<chc>
<rule-repo>checkstyle</rule-repo>
<rule-key>com.puppycrawl.tools.checkstyle.checks.coding.IllegalTokenTextCheck</rule-key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import java.util.List;

import org.junit.Ignore;
import org.junit.Test;
import org.sonar.api.server.rule.RulesDefinition;

Expand All @@ -38,14 +37,15 @@ public class CheckstyleRulesDefinitionTest {
"com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck",
"com.puppycrawl.tools.checkstyle.checks.regexp.RegexpMultilineCheck",
"com.puppycrawl.tools.checkstyle.checks.regexp.RegexpOnFilenameCheck",
"com.puppycrawl.tools.checkstyle.checks.RegexpCheck",
"com.puppycrawl.tools.checkstyle.checks.regexp.RegexpCheck",
"com.puppycrawl.tools.checkstyle.checks.header.RegexpHeaderCheck",
"com.puppycrawl.tools.checkstyle.checks.imports.ImportControlCheck",
"com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck"
"com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck",
"com.puppycrawl.tools.checkstyle.checks.SuppressWarningsHolder",
"com.puppycrawl.tools.checkstyle.checks.FileContentsHolder"
);

@Test
@Ignore
public void test() {
final CheckstyleRulesDefinition definition = new CheckstyleRulesDefinition();
final RulesDefinition.Context context = new RulesDefinition.Context();
Expand All @@ -57,7 +57,7 @@ public void test() {
assertThat(repository.language()).isEqualTo("java");

final List<RulesDefinition.Rule> rules = repository.rules();
assertThat(rules).hasSize(150);
assertThat(rules).hasSize(154);

for (RulesDefinition.Rule rule : rules) {
assertThat(rule.key()).isNotNull();
Expand All @@ -76,15 +76,11 @@ public void test() {
if (NO_SQALE.contains(rule.key())) {
assertThat(rule.debtRemediationFunction()).overridingErrorMessage(
"Sqale remediation function is set for rule '" + rule.key()).isNull();
assertThat(rule.debtSubCharacteristic()).overridingErrorMessage(
"Sqale characteristic is set for rule '" + rule.key()).isNull();
}
else {
assertThat(rule.debtRemediationFunction()).overridingErrorMessage(
"Sqale remediation function is not set for rule '" + rule.key())
.isNotNull();
assertThat(rule.debtSubCharacteristic()).overridingErrorMessage(
"Sqale characteristic is not set for rule '" + rule.key()).isNotNull();
}
}
}
Expand Down

0 comments on commit c0cc087

Please sign in to comment.