{"action":"created","comment":{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/comments/39928554","id":39928554,"diff_hunk":"@@ -106,8 +140,32 @@ private static SyntaxNode ReplaceHeader(Document document, SyntaxNode root, Styl\n                 }\n             }\n \n+            // Remove copyright lines in reverse order\n+            removalList.Reverse();\n+            foreach (var triviaLine in removalList)\n+            {\n+                trivia = trivia.RemoveAt(triviaLine);\n+            }\n+\n             string newLineText = document.Project.Solution.Workspace.Options.GetOption(FormattingOptions.NewLine, LanguageNames.CSharp);\n-            return root.WithLeadingTrivia(CreateNewHeader(document.Name, settings, newLineText).Add(SyntaxFactory.CarriageReturnLineFeed).Add(SyntaxFactory.CarriageReturnLineFeed).AddRange(trivia));\n+\n+            var newHeaderTrivia = CreateNewHeader(document.Name, settings, newLineText);\n+            if (!isMalformedHeader && copyrightTriviaIndex.HasValue)\n+            {\n+                // Replace copyright element in place.\n+                return root.WithLeadingTrivia(trivia.ReplaceRange(trivia[copyrightTriviaIndex.Value], newHeaderTrivia));\n+            }\n+            else\n+            {\n+                // Add blank line if we don't already have comments at top of file.\n+                if ((trivia.Count == 0) || (trivia[0].Kind() != SyntaxKind.SingleLineCommentTrivia))","path":"StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/FileHeaderCodeFixProvider.cs","position":143,"original_position":143,"commit_id":"c3afe7b55a6baf61539e4917ff84bb6d2b84cae6","original_commit_id":"c3afe7b55a6baf61539e4917ff84bb6d2b84cae6","user":{"login":"peteri","id":557645,"avatar_url":"https://avatars.githubusercontent.com/u/557645?v=3","gravatar_id":"","url":"https://api.github.com/users/peteri","html_url":"https://github.com/peteri","followers_url":"https://api.github.com/users/peteri/followers","following_url":"https://api.github.com/users/peteri/following{/other_user}","gists_url":"https://api.github.com/users/peteri/gists{/gist_id}","starred_url":"https://api.github.com/users/peteri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peteri/subscriptions","organizations_url":"https://api.github.com/users/peteri/orgs","repos_url":"https://api.github.com/users/peteri/repos","events_url":"https://api.github.com/users/peteri/events{/privacy}","received_events_url":"https://api.github.com/users/peteri/received_events","type":"User","site_admin":false},"body":"Didn't spot that (will change)","created_at":"2015-09-20T10:37:18Z","updated_at":"2015-09-20T10:37:18Z","html_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/1505#discussion_r39928554","pull_request_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1505","_links":{"self":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/comments/39928554"},"html":{"href":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/1505#discussion_r39928554"},"pull_request":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1505"}}},"pull_request":{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1505","id":45467834,"html_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/1505","diff_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/1505.diff","patch_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/1505.patch","issue_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/1505","number":1505,"state":"open","locked":false,"title":"File header code fix should only replace the copyright element","user":{"login":"peteri","id":557645,"avatar_url":"https://avatars.githubusercontent.com/u/557645?v=3","gravatar_id":"","url":"https://api.github.com/users/peteri","html_url":"https://github.com/peteri","followers_url":"https://api.github.com/users/peteri/followers","following_url":"https://api.github.com/users/peteri/following{/other_user}","gists_url":"https://api.github.com/users/peteri/gists{/gist_id}","starred_url":"https://api.github.com/users/peteri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peteri/subscriptions","organizations_url":"https://api.github.com/users/peteri/orgs","repos_url":"https://api.github.com/users/peteri/repos","events_url":"https://api.github.com/users/peteri/events{/privacy}","received_events_url":"https://api.github.com/users/peteri/received_events","type":"User","site_admin":false},"body":"Fixes for SA1634 & SA1636 to deal with other copyright header elements. If the header is already valid then this only replaces the <copyright> tag contents. Otherwise it does the previous behaviour of replacing the whole header.\r\n\r\nAlso removed trailing spaces on blank lines in copyright text.\r\n\r\nFixes #1434","created_at":"2015-09-19T02:12:21Z","updated_at":"2015-09-20T10:37:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5265b14ae66ab3c7242db56dbb624d9fdcbfb50c","assignee":null,"milestone":{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/milestones/26","html_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/milestones/1.0.0%20Beta%2013","labels_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/milestones/26/labels","id":1312101,"number":26,"title":"1.0.0 Beta 13","description":null,"creator":{"login":"sharwell","id":1408396,"avatar_url":"https://avatars.githubusercontent.com/u/1408396?v=3","gravatar_id":"","url":"https://api.github.com/users/sharwell","html_url":"https://github.com/sharwell","followers_url":"https://api.github.com/users/sharwell/followers","following_url":"https://api.github.com/users/sharwell/following{/other_user}","gists_url":"https://api.github.com/users/sharwell/gists{/gist_id}","starred_url":"https://api.github.com/users/sharwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharwell/subscriptions","organizations_url":"https://api.github.com/users/sharwell/orgs","repos_url":"https://api.github.com/users/sharwell/repos","events_url":"https://api.github.com/users/sharwell/events{/privacy}","received_events_url":"https://api.github.com/users/sharwell/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":10,"state":"open","created_at":"2015-09-18T02:35:00Z","updated_at":"2015-09-20T03:01:07Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1505/commits","review_comments_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1505/comments","review_comment_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/1505/comments","statuses_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/statuses/c3afe7b55a6baf61539e4917ff84bb6d2b84cae6","head":{"label":"peteri:fix-1434","ref":"fix-1434","sha":"c3afe7b55a6baf61539e4917ff84bb6d2b84cae6","user":{"login":"peteri","id":557645,"avatar_url":"https://avatars.githubusercontent.com/u/557645?v=3","gravatar_id":"","url":"https://api.github.com/users/peteri","html_url":"https://github.com/peteri","followers_url":"https://api.github.com/users/peteri/followers","following_url":"https://api.github.com/users/peteri/following{/other_user}","gists_url":"https://api.github.com/users/peteri/gists{/gist_id}","starred_url":"https://api.github.com/users/peteri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peteri/subscriptions","organizations_url":"https://api.github.com/users/peteri/orgs","repos_url":"https://api.github.com/users/peteri/repos","events_url":"https://api.github.com/users/peteri/events{/privacy}","received_events_url":"https://api.github.com/users/peteri/received_events","type":"User","site_admin":false},"repo":{"id":42467110,"name":"StyleCopAnalyzers","full_name":"peteri/StyleCopAnalyzers","owner":{"login":"peteri","id":557645,"avatar_url":"https://avatars.githubusercontent.com/u/557645?v=3","gravatar_id":"","url":"https://api.github.com/users/peteri","html_url":"https://github.com/peteri","followers_url":"https://api.github.com/users/peteri/followers","following_url":"https://api.github.com/users/peteri/following{/other_user}","gists_url":"https://api.github.com/users/peteri/gists{/gist_id}","starred_url":"https://api.github.com/users/peteri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peteri/subscriptions","organizations_url":"https://api.github.com/users/peteri/orgs","repos_url":"https://api.github.com/users/peteri/repos","events_url":"https://api.github.com/users/peteri/events{/privacy}","received_events_url":"https://api.github.com/users/peteri/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/peteri/StyleCopAnalyzers","description":"An implementation of StyleCop rules using the .NET Compiler Platform","fork":true,"url":"https://api.github.com/repos/peteri/StyleCopAnalyzers","forks_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/forks","keys_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/teams","hooks_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/hooks","issue_events_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/issues/events{/number}","events_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/events","assignees_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/assignees{/user}","branches_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/branches{/branch}","tags_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/tags","blobs_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/git/refs{/sha}","trees_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/statuses/{sha}","languages_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/languages","stargazers_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/stargazers","contributors_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/contributors","subscribers_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/subscribers","subscription_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/subscription","commits_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/commits{/sha}","git_commits_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/git/commits{/sha}","comments_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/comments{/number}","issue_comment_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/issues/comments{/number}","contents_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/contents/{+path}","compare_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/merges","archive_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/downloads","issues_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/issues{/number}","pulls_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/pulls{/number}","milestones_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/milestones{/number}","notifications_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/labels{/name}","releases_url":"https://api.github.com/repos/peteri/StyleCopAnalyzers/releases{/id}","created_at":"2015-09-14T18:01:16Z","updated_at":"2015-09-14T18:01:18Z","pushed_at":"2015-09-19T11:20:57Z","git_url":"git://github.com/peteri/StyleCopAnalyzers.git","ssh_url":"git@github.com:peteri/StyleCopAnalyzers.git","clone_url":"https://github.com/peteri/StyleCopAnalyzers.git","svn_url":"https://github.com/peteri/StyleCopAnalyzers","homepage":null,"size":6528,"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":"DotNetAnalyzers:master","ref":"master","sha":"be984ba90c37c4aa90fd43dc017b0fcdfc6e56de","user":{"login":"DotNetAnalyzers","id":9735576,"avatar_url":"https://avatars.githubusercontent.com/u/9735576?v=3","gravatar_id":"","url":"https://api.github.com/users/DotNetAnalyzers","html_url":"https://github.com/DotNetAnalyzers","followers_url":"https://api.github.com/users/DotNetAnalyzers/followers","following_url":"https://api.github.com/users/DotNetAnalyzers/following{/other_user}","gists_url":"https://api.github.com/users/DotNetAnalyzers/gists{/gist_id}","starred_url":"https://api.github.com/users/DotNetAnalyzers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DotNetAnalyzers/subscriptions","organizations_url":"https://api.github.com/users/DotNetAnalyzers/orgs","repos_url":"https://api.github.com/users/DotNetAnalyzers/repos","events_url":"https://api.github.com/users/DotNetAnalyzers/events{/privacy}","received_events_url":"https://api.github.com/users/DotNetAnalyzers/received_events","type":"Organization","site_admin":false},"repo":{"id":26768275,"name":"StyleCopAnalyzers","full_name":"DotNetAnalyzers/StyleCopAnalyzers","owner":{"login":"DotNetAnalyzers","id":9735576,"avatar_url":"https://avatars.githubusercontent.com/u/9735576?v=3","gravatar_id":"","url":"https://api.github.com/users/DotNetAnalyzers","html_url":"https://github.com/DotNetAnalyzers","followers_url":"https://api.github.com/users/DotNetAnalyzers/followers","following_url":"https://api.github.com/users/DotNetAnalyzers/following{/other_user}","gists_url":"https://api.github.com/users/DotNetAnalyzers/gists{/gist_id}","starred_url":"https://api.github.com/users/DotNetAnalyzers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DotNetAnalyzers/subscriptions","organizations_url":"https://api.github.com/users/DotNetAnalyzers/orgs","repos_url":"https://api.github.com/users/DotNetAnalyzers/repos","events_url":"https://api.github.com/users/DotNetAnalyzers/events{/privacy}","received_events_url":"https://api.github.com/users/DotNetAnalyzers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers","description":"An implementation of StyleCop rules using the .NET Compiler Platform","fork":false,"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers","forks_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/forks","keys_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/teams","hooks_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/hooks","issue_events_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/events{/number}","events_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/events","assignees_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/assignees{/user}","branches_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/branches{/branch}","tags_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/tags","blobs_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/git/refs{/sha}","trees_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/statuses/{sha}","languages_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/languages","stargazers_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/stargazers","contributors_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/contributors","subscribers_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/subscribers","subscription_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/subscription","commits_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/commits{/sha}","git_commits_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/git/commits{/sha}","comments_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/comments{/number}","issue_comment_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/comments{/number}","contents_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/contents/{+path}","compare_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/merges","archive_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/downloads","issues_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues{/number}","pulls_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls{/number}","milestones_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/milestones{/number}","notifications_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/labels{/name}","releases_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/releases{/id}","created_at":"2014-11-17T17:29:54Z","updated_at":"2015-09-19T10:56:13Z","pushed_at":"2015-09-20T09:50:51Z","git_url":"git://github.com/DotNetAnalyzers/StyleCopAnalyzers.git","ssh_url":"git@github.com:DotNetAnalyzers/StyleCopAnalyzers.git","clone_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers.git","svn_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers","homepage":null,"size":13834,"stargazers_count":207,"watchers_count":207,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":144,"forks":53,"open_issues":144,"watchers":207,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1505"},"html":{"href":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/1505"},"issue":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/1505"},"comments":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/1505/comments"},"review_comments":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1505/comments"},"review_comment":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1505/commits"},"statuses":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/statuses/c3afe7b55a6baf61539e4917ff84bb6d2b84cae6"}}}}