import org.sonar.api.server.ws.WebService.NewAction;
import org.sonar.api.server.ws.WebService.NewController;
import org.sonar.api.utils.text.JsonWriter;
-import org.sonar.core.util.Uuids;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.db.qualityprofile.ActiveRuleDto;
import org.sonar.server.qualityprofile.QProfileComparison.QProfileComparisonResult;
import static com.google.common.base.Preconditions.checkArgument;
+import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
+import static org.sonar.core.util.Uuids.UUID_EXAMPLE_02;
public class CompareAction implements QProfileWsAction {
.setDescription("Compare two quality profiles.")
.setHandler(this)
.setInternal(true)
- .setResponseExample(getClass().getResource("example-compare.json"))
+ .setResponseExample(getClass().getResource("compare-example.json"))
.setSince("5.2");
compare.createParam(PARAM_LEFT_KEY)
- .setDescription("A profile key.")
- .setExampleValue(Uuids.UUID_EXAMPLE_01)
+ .setDescription("Profile key.")
+ .setExampleValue(UUID_EXAMPLE_01)
.setRequired(true);
compare.createParam(PARAM_RIGHT_KEY)
.setDescription("Another profile key.")
- .setExampleValue(Uuids.UUID_EXAMPLE_02)
+ .setExampleValue(UUID_EXAMPLE_02)
.setRequired(true);
}
json.endObject().close();
}
- private void writeProfile(JsonWriter json, QProfileDto profile) {
+ private static void writeProfile(JsonWriter json, QProfileDto profile) {
json.prop(ATTRIBUTE_KEY, profile.getKee())
.prop(ATTRIBUTE_NAME, profile.getName());
}
--- /dev/null
+{
+ "left" : {
+ "key" : "AU-TpxcA-iU5OvuD2FL1",
+ "name" : "My Profile"
+ },
+ "right" : {
+ "key" : "AU-TpxcA-iU5OvuD2FL5",
+ "name" : "My Other Profile"
+ },
+ "same" : [
+ {
+ "key" : "javascript:EqEqEq",
+ "pluginKey" : "javascript",
+ "pluginName" : "SonarQube",
+ "languageKey": "js",
+ "languageName": "JavaScript",
+ "name" : "\"===\" and \"!==\" should be used instead of \"==\" and \"!=\"",
+ "severity" : "MAJOR"
+ }
+ ],
+ "inLeft" : [
+ {
+ "key" : "javascript:TrailingWhitespace",
+ "pluginKey" : "javascript",
+ "pluginName" : "SonarQube",
+ "languageKey": "js",
+ "languageName": "JavaScript",
+ "name" : "Avoid trailing whitespaces",
+ "severity" : "MAJOR"
+ }
+ ],
+ "inRight" : [
+ {
+ "key" : "javascript:TabCharacter",
+ "pluginKey" : "javascript",
+ "pluginName" : "SonarQube",
+ "languageKey": "js",
+ "languageName": "JavaScript",
+ "name" : "Avoid use of tabulation character",
+ "severity" : "MINOR"
+ }
+ ],
+ "modified" : [
+ {
+ "key" : "javascript:ExcessiveParameterList",
+ "pluginKey" : "javascript",
+ "pluginName" : "SonarQube",
+ "languageKey": "js",
+ "languageName": "JavaScript",
+ "name" : "Avoid function with too many parameters",
+ "right" : {
+ "severity" : "MAJOR",
+ "params" : {
+ "maximumFunctionParameters" : "7"
+ }
+ },
+ "left" : {
+ "severity" : "MAJOR",
+ "params" : {
+ "maximumFunctionParameters" : "10"
+ }
+ }
+ }
+ ]
+}
+++ /dev/null
-{
- "left" : {
- "key" : "AU-TpxcA-iU5OvuD2FL1",
- "name" : "My Profile"
- },
- "right" : {
- "key" : "AU-TpxcA-iU5OvuD2FL5",
- "name" : "My Other Profile"
- },
- "same" : [
- {
- "key" : "javascript:EqEqEq",
- "pluginKey" : "javascript",
- "pluginName" : "SonarQube",
- "languageKey": "js",
- "languageName": "JavaScript",
- "name" : "\"===\" and \"!==\" should be used instead of \"==\" and \"!=\"",
- "severity" : "MAJOR"
- }
- ],
- "inLeft" : [
- {
- "key" : "javascript:TrailingWhitespace",
- "pluginKey" : "javascript",
- "pluginName" : "SonarQube",
- "languageKey": "js",
- "languageName": "JavaScript",
- "name" : "Avoid trailing whitespaces",
- "severity" : "MAJOR"
- }
- ],
- "inRight" : [
- {
- "key" : "javascript:TabCharacter",
- "pluginKey" : "javascript",
- "pluginName" : "SonarQube",
- "languageKey": "js",
- "languageName": "JavaScript",
- "name" : "Avoid use of tabulation character",
- "severity" : "MINOR"
- }
- ],
- "modified" : [
- {
- "key" : "javascript:ExcessiveParameterList",
- "pluginKey" : "javascript",
- "pluginName" : "SonarQube",
- "languageKey": "js",
- "languageName": "JavaScript",
- "name" : "Avoid function with too many parameters",
- "right" : {
- "severity" : "MAJOR",
- "params" : {
- "maximumFunctionParameters" : "7"
- }
- },
- "left" : {
- "severity" : "MAJOR",
- "params" : {
- "maximumFunctionParameters" : "10"
- }
- }
- }
- ]
-}