Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Commit

Permalink
Fixed Sonar base URL detection
Browse files Browse the repository at this point in the history
  • Loading branch information
mrueegg committed Apr 16, 2017
1 parent 55f8cbb commit f1c7075
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ch.mibex.bitbucket.sonar.utils.{LogUtils, SonarUtils}
import org.sonar.api.CoreProperties
import org.sonar.api.batch.CheckProject
import org.sonar.api.batch.postjob.{PostJob, PostJobContext, PostJobDescriptor}
import org.sonar.api.config.Settings
import org.sonar.api.resources.Project
import org.sonar.api.utils.log.Loggers

Expand All @@ -28,10 +29,13 @@ class SonarReviewPostJob(bitbucketClient: BitbucketClient,
}

private def getProjectUrl(context: PostJobContext, pullRequest: PullRequest) =
context.settings().getString(CoreProperties.SERVER_BASE_URL) + "/dashboard?id=" +
getSonarBaseUrl(context.settings()) + "/dashboard?id=" +
context.settings().getString(CoreProperties.PROJECT_KEY_PROPERTY) + ":" +
URLEncoder.encode(pullRequest.srcBranch, "UTF-8")

private def getSonarBaseUrl(settings: Settings) =
Option(settings.getString(CoreProperties.SERVER_BASE_URL)).getOrElse(settings.getString("sonar.host.url"))

private def handlePullRequest(context: PostJobContext, pullRequest: PullRequest) {
setBuildStatus(InProgressBuildStatus, context, pullRequest)
val ourComments = bitbucketClient.findOwnPullRequestComments(pullRequest)
Expand Down

0 comments on commit f1c7075

Please sign in to comment.