{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls/comments/72975480","id":72975480,"diff_hunk":"@@ -180,22 +182,38 @@ function isNullOrEmpty(str) {\n }\n \n // Creates the string that comprises the build summary text, given the location of the /sonar build folder.\n-function createSonarQubeBuildSummary(sqBuildFolder: string): string {\n-    // Task report is not created for PR builds\n+function createSonarQubeBuildSummary(sqBuildFolder:string):Q.Promise<string> {\n+    // Task report is not created for PR builds - inform the user in the build summary\n     if (isPrBuild()) {\n+        tl.debug('Pull request build, will not attempt to fetch detailed SonarQube report');\n         // Looks like: Detailed SonarQube reports are not available for pull request builds.\n-        return tl.loc('sqAnalysis_BuildSummaryNotAvailableInPrBuild');\n+        return Q.when(tl.loc('sqAnalysis_BuildSummaryNotAvailableInPrBuild'));\n     }\n \n-    var taskReport: TaskReport = getSonarQubeTaskReport(sqBuildFolder);\n-    if (!taskReport) {\n-        throw new Error(tl.loc('sqAnalysis_TaskReportInvalid'));\n-    }\n+    // Wait for analysis to finish so that we can get analysis information from the SonarQube server\n+    var timeout:number = 300;\n+    var delay:number = 1;\n \n-    var linkToDashBoard: string = createLinkToSonarQubeDashboard(sqBuildFolder);\n+    var sqRunSettings:SonarQubeRunSettings = getSonarQubeTaskReport(sqBuildFolder);\n \n-    // Put the quality gate status and dashboard link sections together with the Markdown newline\n-    return linkToDashBoard;\n+    var sqServer:ISonarQubeServer = new SonarQubeServer();\n+    var analysisMetrics:SonarQubeMetrics = new SonarQubeMetrics(sqServer, sqRunSettings.ceTaskId, timeout, delay);\n+    var sqReportBuilder:SonarQubeReportBuilder = new SonarQubeReportBuilder(sqRunSettings, analysisMetrics);\n+\n+    // Looks like: \"[Detailed SonarQube report >](https://mySQserver:9000/dashboard/index/foo \"foo Dashboard\")\"\n+    var linkToDashBoard:string = sqReportBuilder.createLinkToSonarQubeDashboard();","path":"Tasks/Gradle/sonarqube-common/sonarqube-common.ts","position":102,"original_position":102,"commit_id":"d44fb5735d75711be4537aec3d5835dae94c30b3","original_commit_id":"d44fb5735d75711be4537aec3d5835dae94c30b3","user":{"login":"bgavrilMS","id":12273384,"avatar_url":"https://avatars.githubusercontent.com/u/12273384?v=3","gravatar_id":"","url":"https://api.github.com/users/bgavrilMS","html_url":"https://github.com/bgavrilMS","followers_url":"https://api.github.com/users/bgavrilMS/followers","following_url":"https://api.github.com/users/bgavrilMS/following{/other_user}","gists_url":"https://api.github.com/users/bgavrilMS/gists{/gist_id}","starred_url":"https://api.github.com/users/bgavrilMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgavrilMS/subscriptions","organizations_url":"https://api.github.com/users/bgavrilMS/orgs","repos_url":"https://api.github.com/users/bgavrilMS/repos","events_url":"https://api.github.com/users/bgavrilMS/events{/privacy}","received_events_url":"https://api.github.com/users/bgavrilMS/received_events","type":"User","site_admin":false},"body":"The sections of the report and the binding of these sections should also be part of the ReportBuilder and not exposed here. ","created_at":"2016-08-01T13:16:34Z","updated_at":"2016-08-01T13:16:34Z","html_url":"https://github.com/Microsoft/vsts-tasks/pull/2170#discussion_r72975480","pull_request_url":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls/2170","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls/comments/72975480"},"html":{"href":"https://github.com/Microsoft/vsts-tasks/pull/2170#discussion_r72975480"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls/2170"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls/2170","id":79560171,"html_url":"https://github.com/Microsoft/vsts-tasks/pull/2170","diff_url":"https://github.com/Microsoft/vsts-tasks/pull/2170.diff","patch_url":"https://github.com/Microsoft/vsts-tasks/pull/2170.patch","issue_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/2170","number":2170,"state":"open","locked":false,"title":"SonarQube build summary now includes quality gate status.","user":{"login":"HSAR","id":985911,"avatar_url":"https://avatars.githubusercontent.com/u/985911?v=3","gravatar_id":"","url":"https://api.github.com/users/HSAR","html_url":"https://github.com/HSAR","followers_url":"https://api.github.com/users/HSAR/followers","following_url":"https://api.github.com/users/HSAR/following{/other_user}","gists_url":"https://api.github.com/users/HSAR/gists{/gist_id}","starred_url":"https://api.github.com/users/HSAR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HSAR/subscriptions","organizations_url":"https://api.github.com/users/HSAR/orgs","repos_url":"https://api.github.com/users/HSAR/repos","events_url":"https://api.github.com/users/HSAR/events{/privacy}","received_events_url":"https://api.github.com/users/HSAR/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-01T12:29:02Z","updated_at":"2016-08-01T13:16:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"080d2dd4be23c18d926b764bb98619e0041506f9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls/2170/commits","review_comments_url":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls/2170/comments","review_comment_url":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/2170/comments","statuses_url":"https://api.github.com/repos/Microsoft/vsts-tasks/statuses/d44fb5735d75711be4537aec3d5835dae94c30b3","head":{"label":"Microsoft:users/sschen/wip","ref":"users/sschen/wip","sha":"d44fb5735d75711be4537aec3d5835dae94c30b3","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":27631673,"name":"vsts-tasks","full_name":"Microsoft/vsts-tasks","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/vsts-tasks","description":"Build and Release Tasks for Visual Studio Team Services and Team Foundation Server","fork":false,"url":"https://api.github.com/repos/Microsoft/vsts-tasks","forks_url":"https://api.github.com/repos/Microsoft/vsts-tasks/forks","keys_url":"https://api.github.com/repos/Microsoft/vsts-tasks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/vsts-tasks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/vsts-tasks/teams","hooks_url":"https://api.github.com/repos/Microsoft/vsts-tasks/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/vsts-tasks/events","assignees_url":"https://api.github.com/repos/Microsoft/vsts-tasks/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/vsts-tasks/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/vsts-tasks/tags","blobs_url":"https://api.github.com/repos/Microsoft/vsts-tasks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/vsts-tasks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/vsts-tasks/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/vsts-tasks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/vsts-tasks/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/vsts-tasks/languages","stargazers_url":"https://api.github.com/repos/Microsoft/vsts-tasks/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/vsts-tasks/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/vsts-tasks/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/vsts-tasks/subscription","commits_url":"https://api.github.com/repos/Microsoft/vsts-tasks/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/vsts-tasks/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/vsts-tasks/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/vsts-tasks/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/vsts-tasks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/vsts-tasks/merges","archive_url":"https://api.github.com/repos/Microsoft/vsts-tasks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/vsts-tasks/downloads","issues_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/vsts-tasks/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/vsts-tasks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/vsts-tasks/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/vsts-tasks/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/vsts-tasks/deployments","created_at":"2014-12-06T11:11:46Z","updated_at":"2016-07-29T15:53:17Z","pushed_at":"2016-08-01T13:14:57Z","git_url":"git://github.com/Microsoft/vsts-tasks.git","ssh_url":"git@github.com:Microsoft/vsts-tasks.git","clone_url":"https://github.com/Microsoft/vsts-tasks.git","svn_url":"https://github.com/Microsoft/vsts-tasks","homepage":"https://www.visualstudio.com/features/devops-vs","size":17066,"stargazers_count":363,"watchers_count":363,"language":"PowerShell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":321,"mirror_url":null,"open_issues_count":109,"forks":321,"open_issues":109,"watchers":363,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"5c0772238bf46de6e94ca8c9bdefd54e57d70584","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":27631673,"name":"vsts-tasks","full_name":"Microsoft/vsts-tasks","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/vsts-tasks","description":"Build and Release Tasks for Visual Studio Team Services and Team Foundation Server","fork":false,"url":"https://api.github.com/repos/Microsoft/vsts-tasks","forks_url":"https://api.github.com/repos/Microsoft/vsts-tasks/forks","keys_url":"https://api.github.com/repos/Microsoft/vsts-tasks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/vsts-tasks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/vsts-tasks/teams","hooks_url":"https://api.github.com/repos/Microsoft/vsts-tasks/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/vsts-tasks/events","assignees_url":"https://api.github.com/repos/Microsoft/vsts-tasks/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/vsts-tasks/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/vsts-tasks/tags","blobs_url":"https://api.github.com/repos/Microsoft/vsts-tasks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/vsts-tasks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/vsts-tasks/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/vsts-tasks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/vsts-tasks/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/vsts-tasks/languages","stargazers_url":"https://api.github.com/repos/Microsoft/vsts-tasks/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/vsts-tasks/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/vsts-tasks/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/vsts-tasks/subscription","commits_url":"https://api.github.com/repos/Microsoft/vsts-tasks/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/vsts-tasks/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/vsts-tasks/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/vsts-tasks/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/vsts-tasks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/vsts-tasks/merges","archive_url":"https://api.github.com/repos/Microsoft/vsts-tasks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/vsts-tasks/downloads","issues_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/vsts-tasks/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/vsts-tasks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/vsts-tasks/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/vsts-tasks/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/vsts-tasks/deployments","created_at":"2014-12-06T11:11:46Z","updated_at":"2016-07-29T15:53:17Z","pushed_at":"2016-08-01T13:14:57Z","git_url":"git://github.com/Microsoft/vsts-tasks.git","ssh_url":"git@github.com:Microsoft/vsts-tasks.git","clone_url":"https://github.com/Microsoft/vsts-tasks.git","svn_url":"https://github.com/Microsoft/vsts-tasks","homepage":"https://www.visualstudio.com/features/devops-vs","size":17066,"stargazers_count":363,"watchers_count":363,"language":"PowerShell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":321,"mirror_url":null,"open_issues_count":109,"forks":321,"open_issues":109,"watchers":363,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls/2170"},"html":{"href":"https://github.com/Microsoft/vsts-tasks/pull/2170"},"issue":{"href":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/2170"},"comments":{"href":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/2170/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls/2170/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/vsts-tasks/pulls/2170/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/vsts-tasks/statuses/d44fb5735d75711be4537aec3d5835dae94c30b3"}}}}
{"actor":{"display_login":"bgavrilMS"}}