1
0
forked from phoedos/pmd

Fixed Code Climate renderer test

This commit is contained in:
Robert Sösemann
2016-04-18 15:39:46 +02:00
parent c50fd060ed
commit 9d5598e63a
2 changed files with 8 additions and 4 deletions
pmd-core/src
main/java/net/sourceforge/pmd/renderers
test/java/net/sourceforge/pmd/renderers

@ -72,13 +72,17 @@ public class CodeClimateRenderer extends AbstractIncrementingRenderer {
break;
}
issue.remediation_points = REMEDIATION_POINTS_DEFAULT;
if(rule.hasDescriptor(CODECLIMATE_REMEDIATION_MULTIPLIER)) {
issue.remediation_points = rule.getProperty(CODECLIMATE_REMEDIATION_MULTIPLIER) * REMEDIATION_POINTS_DEFAULT;
issue.remediation_points *= rule.getProperty(CODECLIMATE_REMEDIATION_MULTIPLIER);
}
if(rule.hasDescriptor(CODECLIMATE_CATEGORIES)) {
issue.categories = rule.getProperty(CODECLIMATE_CATEGORIES);
}
else {
issue.categories = new String[]{ "Style" };
}
return issue;
}

@ -14,7 +14,7 @@ public class CodeClimateRendererTest extends AbstractRendererTst {
@Override
public String getExpected() {
return "{\"type\":\"issue\",\"check_name\":\"Foo\",\"description\":\"blah\",\"content\":{\"body\":\"desc\"},\"categories\":[\"Style\"],\"location\":{\"path\":\"n/a\",\"lines\":{\"begin\":1,\"end\":1}},\"severity\":\"info\"}" + PMD.EOL;
return "{\"type\":\"issue\",\"check_name\":\"Foo\",\"description\":\"blah\",\"content\":{\"body\":\"desc\"},\"categories\":[\"Style\"],\"location\":{\"path\":\"n/a\",\"lines\":{\"begin\":1,\"end\":1}},\"severity\":\"info\",\"remediation_points\":50000}" + "\u0000" + PMD.EOL;
}
@Override
@ -24,8 +24,8 @@ public class CodeClimateRendererTest extends AbstractRendererTst {
@Override
public String getExpectedMultiple() {
return "{\"type\":\"issue\",\"check_name\":\"Foo\",\"description\":\"blah\",\"content\":{\"body\":\"desc\"},\"categories\":[\"Style\"],\"location\":{\"path\":\"n/a\",\"lines\":{\"begin\":1,\"end\":1}},\"severity\":\"info\"}" + PMD.EOL +
"{\"type\":\"issue\",\"check_name\":\"Foo\",\"description\":\"blah\",\"content\":{\"body\":\"desc\"},\"categories\":[\"Style\"],\"location\":{\"path\":\"n/a\",\"lines\":{\"begin\":1,\"end\":1}},\"severity\":\"info\"}" + PMD.EOL;
return "{\"type\":\"issue\",\"check_name\":\"Foo\",\"description\":\"blah\",\"content\":{\"body\":\"desc\"},\"categories\":[\"Style\"],\"location\":{\"path\":\"n/a\",\"lines\":{\"begin\":1,\"end\":1}},\"severity\":\"info\",\"remediation_points\":50000}" + "\u0000" + PMD.EOL +
"{\"type\":\"issue\",\"check_name\":\"Foo\",\"description\":\"blah\",\"content\":{\"body\":\"desc\"},\"categories\":[\"Style\"],\"location\":{\"path\":\"n/a\",\"lines\":{\"begin\":1,\"end\":1}},\"severity\":\"info\",\"remediation_points\":50000}" + "\u0000" + PMD.EOL;
}
public static junit.framework.Test suite() {