global = true, project = false,
defaultValue = CoreProperties.PREVIEW_EXCLUDE_PLUGINS_DEFAULT_VALUE,
category = CoreProperties.CATEGORY_GENERAL),
- @Property(
- key = "sonar.report.export.path",
- defaultValue = "sonar-report.json",
- name = "Report Results Export File",
- type = PropertyType.STRING,
- global = false, project = false),
// SERVER-SIDE TECHNICAL PROPERTIES
import org.sonar.batch.maven.MavenProjectBuilder;
import org.sonar.batch.maven.MavenProjectConverter;
import org.sonar.batch.scan.report.ConsoleReport;
+import org.sonar.batch.scan.report.JSONReport;
import org.sonar.batch.scm.ScmConfiguration;
import org.sonar.batch.scm.ScmSensor;
import org.sonar.batch.source.LinesSensor;
// Reports
ConsoleReport.class,
+ JSONReport.class,
// dbcleaner
DefaultPeriodCleaner.class,
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.sonar.api.Properties;
+import org.sonar.api.Property;
+import org.sonar.api.PropertyType;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputDir;
import org.sonar.api.batch.fs.InputFile;
import static com.google.common.collect.Sets.newHashSet;
+@Properties({
+ @Property(
+ key = JSONReport.SONAR_REPORT_EXPORT_PATH,
+ defaultValue = "sonar-report.json",
+ name = "Report Results Export File",
+ type = PropertyType.STRING,
+ global = false, project = false)})
public class JSONReport implements Reporter {
+ static final String SONAR_REPORT_EXPORT_PATH = "sonar.report.export.path";
private static final Logger LOG = LoggerFactory.getLogger(JSONReport.class);
private final Settings settings;
private final FileSystem fileSystem;
@Override
public void execute() {
- String exportPath = settings.getString("sonar.report.export.path");
+ String exportPath = settings.getString(SONAR_REPORT_EXPORT_PATH);
if (exportPath != null) {
exportResults(exportPath);
}
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
public class UserRepository {
}
public Collection<User> loadFromWs(List<String> userLogins) {
+ if (userLogins.isEmpty()) {
+ return Collections.emptyList();
+ }
String url = "/api/users/search?format=json&includeDeactivated=true&logins=" + Joiner.on(',').join(userLogins);
String json = serverClient.request(url);
Users users = GsonHelper.create().fromJson(json, Users.class);