{"action":"created","comment":{"url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/pulls/comments/45870024","id":45870024,"diff_hunk":"@@ -0,0 +1,95 @@\n+﻿//-----------------------------------------------------------------------\n+// <copyright file=\"MergeRulesets.cs\" company=\"SonarSource SA and Microsoft Corporation\">\n+//   Copyright (c) SonarSource SA and Microsoft Corporation.  All rights reserved.\n+//   Licensed under the MIT License. See License.txt in the project root for license information.\n+// </copyright>\n+//-----------------------------------------------------------------------\n+\n+using Microsoft.Build.Framework;\n+using Microsoft.Build.Utilities;\n+using System;\n+using System.IO;\n+using System.Linq;\n+using System.Xml.Linq;\n+\n+namespace SonarQube.MSBuild.Tasks\n+{\n+    /// <summary>\n+    /// MSBuild task to merge rulesets by adding \"Include\" references to a\n+    /// specified ruleset\n+    /// </summary>\n+    public class MergeRulesets : Task\n+    {\n+        private static readonly XName IncludeElementName = \"Include\";\n+        private static readonly XName PathAttributeName = \"Path\";\n+        private static readonly XName ActionAttributeName = \"Action\";\n+        private const string DefaultActionValue = \"Default\";\n+\n+        #region Input properties\n+\n+        /// <summary>\n+        /// The path to the main ruleset file i.e. the one that will include the others\n+        /// </summary>\n+        [Required]\n+        public string PrimaryRulesetFilePath { get; set; }\n+\n+        /// <summary>\n+        /// The full file paths of any rulesets to include. Can be empty, in which case the task is a no-op.\n+        /// </summary>\n+        public string[] IncludedRulesetFilePaths { get; set; }\n+\n+        #endregion Input properties\n+\n+        #region Overrides\n+\n+        public override bool Execute()\n+        {\n+            if (!File.Exists(this.PrimaryRulesetFilePath))\n+            {\n+                throw new FileNotFoundException(Resources.MergeRulesets_MissingPrimaryRuleset, this.PrimaryRulesetFilePath);\n+            }\n+            if (this.IncludedRulesetFilePaths == null || this.IncludedRulesetFilePaths.Length == 0)\n+            {\n+                return true; // nothing to do if there are no rulesets\n+            }\n+            bool taskSuccess = true;","path":"SonarQube.MSBuild.Tasks/MergeRulesets.cs","position":55,"original_position":55,"commit_id":"37b421ea5ab18a9194fe233dc85292fe626b57a4","original_commit_id":"37b421ea5ab18a9194fe233dc85292fe626b57a4","user":{"login":"duncanpMS","id":10757559,"avatar_url":"https://avatars.githubusercontent.com/u/10757559?v=3","gravatar_id":"","url":"https://api.github.com/users/duncanpMS","html_url":"https://github.com/duncanpMS","followers_url":"https://api.github.com/users/duncanpMS/followers","following_url":"https://api.github.com/users/duncanpMS/following{/other_user}","gists_url":"https://api.github.com/users/duncanpMS/gists{/gist_id}","starred_url":"https://api.github.com/users/duncanpMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duncanpMS/subscriptions","organizations_url":"https://api.github.com/users/duncanpMS/orgs","repos_url":"https://api.github.com/users/duncanpMS/repos","events_url":"https://api.github.com/users/duncanpMS/events{/privacy}","received_events_url":"https://api.github.com/users/duncanpMS/received_events","type":"User","site_admin":false},"body":"Removed.","created_at":"2015-11-25T14:10:19Z","updated_at":"2015-11-25T14:10:19Z","html_url":"https://github.com/SonarSource/sonar-msbuild-runner/pull/155#discussion_r45870024","pull_request_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/pulls/155","_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/pulls/comments/45870024"},"html":{"href":"https://github.com/SonarSource/sonar-msbuild-runner/pull/155#discussion_r45870024"},"pull_request":{"href":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/pulls/155"}}},"pull_request":{"url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/pulls/155","id":51792857,"html_url":"https://github.com/SonarSource/sonar-msbuild-runner/pull/155","diff_url":"https://github.com/SonarSource/sonar-msbuild-runner/pull/155.diff","patch_url":"https://github.com/SonarSource/sonar-msbuild-runner/pull/155.patch","issue_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/issues/155","number":155,"state":"open","locked":false,"title":"[SONARMSBRU-183] Added MSBuild task to add merge result sets","user":{"login":"duncanpMS","id":10757559,"avatar_url":"https://avatars.githubusercontent.com/u/10757559?v=3","gravatar_id":"","url":"https://api.github.com/users/duncanpMS","html_url":"https://github.com/duncanpMS","followers_url":"https://api.github.com/users/duncanpMS/followers","following_url":"https://api.github.com/users/duncanpMS/following{/other_user}","gists_url":"https://api.github.com/users/duncanpMS/gists{/gist_id}","starred_url":"https://api.github.com/users/duncanpMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duncanpMS/subscriptions","organizations_url":"https://api.github.com/users/duncanpMS/orgs","repos_url":"https://api.github.com/users/duncanpMS/repos","events_url":"https://api.github.com/users/duncanpMS/events{/privacy}","received_events_url":"https://api.github.com/users/duncanpMS/received_events","type":"User","site_admin":false},"body":"This commit can't be manually tested yet; it just adds the new task and tests. The targets haven't been changed to call it yet. I'm sending this for review now to make the next review which will change the targets simpler.","created_at":"2015-11-25T13:18:39Z","updated_at":"2015-11-25T14:10:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf0520e6f2bceb6037b5a607536b40d62900af7c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/pulls/155/commits","review_comments_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/pulls/155/comments","review_comment_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/issues/155/comments","statuses_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/statuses/37b421ea5ab18a9194fe233dc85292fe626b57a4","head":{"label":"duncanpMS:sonarmsbru-183","ref":"sonarmsbru-183","sha":"37b421ea5ab18a9194fe233dc85292fe626b57a4","user":{"login":"duncanpMS","id":10757559,"avatar_url":"https://avatars.githubusercontent.com/u/10757559?v=3","gravatar_id":"","url":"https://api.github.com/users/duncanpMS","html_url":"https://github.com/duncanpMS","followers_url":"https://api.github.com/users/duncanpMS/followers","following_url":"https://api.github.com/users/duncanpMS/following{/other_user}","gists_url":"https://api.github.com/users/duncanpMS/gists{/gist_id}","starred_url":"https://api.github.com/users/duncanpMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duncanpMS/subscriptions","organizations_url":"https://api.github.com/users/duncanpMS/orgs","repos_url":"https://api.github.com/users/duncanpMS/repos","events_url":"https://api.github.com/users/duncanpMS/events{/privacy}","received_events_url":"https://api.github.com/users/duncanpMS/received_events","type":"User","site_admin":false},"repo":{"id":36438614,"name":"sonar-msbuild-runner","full_name":"duncanpMS/sonar-msbuild-runner","owner":{"login":"duncanpMS","id":10757559,"avatar_url":"https://avatars.githubusercontent.com/u/10757559?v=3","gravatar_id":"","url":"https://api.github.com/users/duncanpMS","html_url":"https://github.com/duncanpMS","followers_url":"https://api.github.com/users/duncanpMS/followers","following_url":"https://api.github.com/users/duncanpMS/following{/other_user}","gists_url":"https://api.github.com/users/duncanpMS/gists{/gist_id}","starred_url":"https://api.github.com/users/duncanpMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duncanpMS/subscriptions","organizations_url":"https://api.github.com/users/duncanpMS/orgs","repos_url":"https://api.github.com/users/duncanpMS/repos","events_url":"https://api.github.com/users/duncanpMS/events{/privacy}","received_events_url":"https://api.github.com/users/duncanpMS/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/duncanpMS/sonar-msbuild-runner","description":"","fork":true,"url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner","forks_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/forks","keys_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/teams","hooks_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/hooks","issue_events_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/issues/events{/number}","events_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/events","assignees_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/assignees{/user}","branches_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/branches{/branch}","tags_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/tags","blobs_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/git/refs{/sha}","trees_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/statuses/{sha}","languages_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/languages","stargazers_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/stargazers","contributors_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/contributors","subscribers_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/subscribers","subscription_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/subscription","commits_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/commits{/sha}","git_commits_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/git/commits{/sha}","comments_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/comments{/number}","issue_comment_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/issues/comments{/number}","contents_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/contents/{+path}","compare_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/merges","archive_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/downloads","issues_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/issues{/number}","pulls_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/pulls{/number}","milestones_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/milestones{/number}","notifications_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/labels{/name}","releases_url":"https://api.github.com/repos/duncanpMS/sonar-msbuild-runner/releases{/id}","created_at":"2015-05-28T13:02:03Z","updated_at":"2015-08-27T20:11:31Z","pushed_at":"2015-11-25T13:14:38Z","git_url":"git://github.com/duncanpMS/sonar-msbuild-runner.git","ssh_url":"git@github.com:duncanpMS/sonar-msbuild-runner.git","clone_url":"https://github.com/duncanpMS/sonar-msbuild-runner.git","svn_url":"https://github.com/duncanpMS/sonar-msbuild-runner","homepage":null,"size":2904,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"SonarSource:master","ref":"master","sha":"e50f0700ec6d4bd1fe6c415fa1acbef729b63d30","user":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"repo":{"id":34444711,"name":"sonar-msbuild-runner","full_name":"SonarSource/sonar-msbuild-runner","owner":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SonarSource/sonar-msbuild-runner","description":"","fork":false,"url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner","forks_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/forks","keys_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/events","assignees_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/merges","archive_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/releases{/id}","created_at":"2015-04-23T08:45:40Z","updated_at":"2015-11-18T07:58:58Z","pushed_at":"2015-11-25T13:18:41Z","git_url":"git://github.com/SonarSource/sonar-msbuild-runner.git","ssh_url":"git@github.com:SonarSource/sonar-msbuild-runner.git","clone_url":"https://github.com/SonarSource/sonar-msbuild-runner.git","svn_url":"https://github.com/SonarSource/sonar-msbuild-runner","homepage":null,"size":3009,"stargazers_count":23,"watchers_count":23,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":3,"forks":22,"open_issues":3,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/pulls/155"},"html":{"href":"https://github.com/SonarSource/sonar-msbuild-runner/pull/155"},"issue":{"href":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/issues/155"},"comments":{"href":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/issues/155/comments"},"review_comments":{"href":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/pulls/155/comments"},"review_comment":{"href":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/pulls/155/commits"},"statuses":{"href":"https://api.github.com/repos/SonarSource/sonar-msbuild-runner/statuses/37b421ea5ab18a9194fe233dc85292fe626b57a4"}}}}