Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove parse "parameter" in "periods" from json results of api/qualitygates/project_status. (SonarQube 7.2.1) #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
4 changes: 2 additions & 2 deletions sonar-qualitygates-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.thoughtworks.go</groupId>
<artifactId>gocd-sonar-qualitygates-plugin</artifactId>
<version>1.0.0</version>
<version>2.0.1</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -28,7 +28,7 @@
<dependency>
<groupId>com.thoughtworks.go</groupId>
<artifactId>gocd-plugin-common</artifactId>
<version>${project.version}</version>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public Result execute() throws Exception {
JSONObject lastPeriod = (JSONObject) periods.get(periods.length() - 1);

String lastDate = (String) lastPeriod.get("date");
String lastVersion = (String) lastPeriod.get("parameter");
// String lastVersion = (String) lastPeriod.get("parameter");

if (!("".equals(stageName)) && !("".equals(jobName)) && !("".equals(jobCounter))) {
String scheduledTime = getScheduledTime();
Expand Down Expand Up @@ -83,7 +83,7 @@ public Result execute() throws Exception {
log("No new scan has been found !");

log("Date of Sonar scan: " + lastDate);
log("Version of Sonar scan: " + lastVersion);
// log("Version of Sonar scan: " + lastVersion);

return new Result(false, "Failed to get a newer quality gate for " + sonarProjectKey
+ ". The present quality gate is older than the start of the Sonar scan task.");
Expand All @@ -94,7 +94,7 @@ public Result execute() throws Exception {
}

log("Date of Sonar scan: " + lastDate);
log("Version of Sonar scan: " + lastVersion);
// log("Version of Sonar scan: " + lastVersion);

SonarParser parser = new SonarParser(result);

Expand All @@ -108,7 +108,7 @@ public Result execute() throws Exception {
else {

log("Date of Sonar scan: " + lastDate);
log("Version of Sonar scan: " + lastVersion);
// log("Version of Sonar scan: " + lastVersion);

SonarParser parser = new SonarParser(result);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public void testQualityGateResult() throws Exception {
SonarParser parser = new SonarParser(result);

// check that a quality gate is returned
JSONObject qgDetails = parser.GetQualityGateDetails();

String qgResult = qgDetails.getString("level");
// JSONObject qgDetails = parser.GetQualityGateDetails();
// String qgResult = qgDetails.getString("level");
String qgResult = parser.getProjectQualityGateStatus();
Assert.assertEquals("ERROR", qgResult);
}

Expand Down