" \"action\": \"ACTIVATED\",\n" +
" \"ruleKey\": \"" + rule.getKey() + "\",\n" +
" \"ruleName\": \"" + rule.getName() + "\",\n" +
+ " \"cleanCodeAttributeCategory\": \"INTENTIONAL\",\n" +
+ " \"impacts\": [\n" +
+ " {\n" +
+ " \"softwareQuality\": \"MAINTAINABILITY\",\n" +
+ " \"severity\": \"HIGH\"\n" +
+ " }\n" +
+ " ]," +
" \"params\": {\n" +
" \"severity\": \"MINOR\",\n" +
" \"bar\": \"bar_value\",\n" +
insertChange(c -> c.setRulesProfileUuid(profileUuid)
.setUserUuid(user3.getUuid())
.setChangeType(ActiveRuleChange.Type.ACTIVATED.name())
- .setData(ImmutableMap.of("severity", "MAJOR", "param_format", "^[A-Z][a-zA-Z0-9]*$", "ruleUuid", rule3.getUuid())));
+ .setData(ImmutableMap.of("severity", "MAJOR", "param_format", "^[A-Z][a-zA-Z0-9]*", "ruleUuid", rule3.getUuid())));
ws.newRequest()
.setMethod("GET")
"authorName" : "Anakin Skywalker",
"ruleKey" : "java:S2438",
"ruleName" : "\"Threads\" should not be used where \"Runnables\" are expected",
+ "cleanCodeAttributeCategory": "INTENTIONAL",
+ "impacts": [
+ {
+ "softwareQuality": "MAINTAINABILITY",
+ "severity": "HIGH"
+ }
+ ],
"params" : {
"severity" : "CRITICAL"
}
"authorLogin" : "padme.amidala",
"authorName" : "Padme Amidala",
"ruleKey" : "java:S2162",
- "ruleName" : "\"equals\" methods should be symmetric and work for subclasses"
+ "ruleName" : "\"equals\" methods should be symmetric and work for subclasses",
+ "cleanCodeAttributeCategory": "INTENTIONAL",
+ "impacts": [
+ {
+ "softwareQuality": "MAINTAINABILITY",
+ "severity": "HIGH"
+ }
+ ],
+ "params" : {}
},
{
"action" : "ACTIVATED",
"ruleKey" : "java:S00101",
"ruleName" : "Class names should comply with a naming convention",
"date" : "2014-09-12T15:20:46+0200",
+ "cleanCodeAttributeCategory": "INTENTIONAL",
+ "impacts": [
+ {
+ "softwareQuality": "MAINTAINABILITY",
+ "severity": "HIGH"
+ }
+ ],
"params" : {
"severity" : "MAJOR",
- "format" : "^[A-Z][a-zA-Z0-9]*$"
+ "format" : "^[A-Z][a-zA-Z0-9]*"
}
}
]
import org.sonar.api.utils.text.JsonWriter;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
+import org.sonar.db.issue.ImpactDto;
import org.sonar.db.qualityprofile.QProfileChangeDto;
import org.sonar.db.qualityprofile.QProfileChangeQuery;
import org.sonar.db.qualityprofile.QProfileDto;
"Events are ordered by date in descending order (most recent first).")
.setChangelog(
new org.sonar.api.server.ws.Change("9.8", "response fields 'total', 's', 'ps' have been deprecated, please use 'paging' object instead"),
- new org.sonar.api.server.ws.Change("9.8", "The field 'paging' has been added to the response"))
+ new org.sonar.api.server.ws.Change("9.8", "The field 'paging' has been added to the response"),
+ new org.sonar.api.server.ws.Change("10.3", "Added fields 'cleanCodeAttributeCategory' and 'impacts' to response"))
.setHandler(this)
.setResponseExample(getClass().getResource("changelog-example.json"));
changeWriter
.prop("ruleKey", rule.getKey().toString())
.prop("ruleName", rule.getName());
+
+ if (rule.getCleanCodeAttribute() != null) {
+ changeWriter
+ .prop("cleanCodeAttributeCategory", rule.getCleanCodeAttribute().getAttributeCategory().toString());
+ }
+ changeWriter
+ .name("impacts")
+ .beginArray();
+ for (ImpactDto impact : rule.getDefaultImpacts()) {
+ changeWriter
+ .beginObject()
+ .prop("softwareQuality", impact.getSoftwareQuality().toString())
+ .prop("severity", impact.getSeverity().toString())
+ .endObject();
+ }
+
+ changeWriter.endArray();
}
writeParameters(json, change);
json.endObject();
"authorName" : "Anakin Skywalker",
"ruleKey" : "java:S2438",
"ruleName" : "\"Threads\" should not be used where \"Runnables\" are expected",
+ "cleanCodeAttributeCategory": "INTENTIONAL",
+ "impacts": [
+ {
+ "softwareQuality": "RELIABILITY",
+ "severity": "LOW"
+ },
+ {
+ "softwareQuality": "SECURITY",
+ "severity": "HIGH"
+ }
+ ],
"params" : {
"severity" : "CRITICAL"
}
"authorLogin" : "padme.amidala",
"authorName" : "Padme Amidala",
"ruleKey" : "java:S2162",
- "ruleName" : "\"equals\" methods should be symmetric and work for subclasses"
+ "ruleName" : "\"equals\" methods should be symmetric and work for subclasses",
+ "cleanCodeAttributeCategory": "INTENTIONAL",
+ "impacts": [
+ {
+ "softwareQuality": "RELIABILITY",
+ "severity": "LOW"
+ },
+ {
+ "softwareQuality": "SECURITY",
+ "severity": "HIGH"
+ }
+ ]
},
{
"action" : "ACTIVATED",
"authorName" : "Obiwan Kenobi",
"ruleKey" : "java:S00101",
"ruleName" : "Class names should comply with a naming convention",
+ "cleanCodeAttributeCategory": "INTENTIONAL",
+ "impacts": [
+ {
+ "softwareQuality": "RELIABILITY",
+ "severity": "LOW"
+ },
+ {
+ "softwareQuality": "SECURITY",
+ "severity": "HIGH"
+ }
+ ],
"date" : "2014-09-12T15:20:46+0200",
"params" : {
"severity" : "MAJOR",