{"action":"created","comment":{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/comments/37701721","id":37701721,"diff_hunk":"@@ -0,0 +1,92 @@\n+﻿namespace StyleCop.Analyzers.DocumentationRules\n+{\n+    using System.Collections.Immutable;\n+    using System.Composition;\n+    using System.Linq;\n+    using System.Threading;\n+    using System.Threading.Tasks;\n+    using Microsoft.CodeAnalysis;\n+    using Microsoft.CodeAnalysis.CodeActions;\n+    using Microsoft.CodeAnalysis.CodeFixes;\n+    using Microsoft.CodeAnalysis.CSharp;\n+    using StyleCop.Analyzers.Helpers;\n+\n+    /// <summary>\n+    /// Implements a code fix for <see cref=\"SA1633FileMustHaveHeader\"/>.\n+    /// </summary>\n+    /// <remarks>\n+    /// <para>To fix a violation of this rule, remove the <c>&lt;returns&gt;</c> tag from the element.</para>\n+    /// </remarks>\n+    [ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(SA1633CodeFixProvider))]\n+    [Shared]\n+    public class SA1633CodeFixProvider : CodeFixProvider\n+    {\n+        private const string CompanyName = \"FooCorp\"; // Should come from settings.\n+\n+        private static readonly ImmutableArray<string> FixableDiagnostics =\n+            ImmutableArray.Create(SA1633FileMustHaveHeader.DiagnosticId);\n+\n+        /// <inheritdoc/>\n+        public override ImmutableArray<string> FixableDiagnosticIds => FixableDiagnostics;\n+\n+        /// <inheritdoc/>\n+        public override FixAllProvider GetFixAllProvider()\n+        {\n+            return CustomFixAllProviders.BatchFixer;\n+        }\n+\n+        /// <inheritdoc/>\n+        public override Task RegisterCodeFixesAsync(CodeFixContext context)\n+        {\n+            foreach (Diagnostic diagnostic in context.Diagnostics.Where(d => FixableDiagnostics.Contains(d.Id)))\n+            {\n+                context.RegisterCodeFix(CodeAction.Create(DocumentationResources.SA1633CodeFix, token => GetTransformedDocumentAsync(context.Document, token), equivalenceKey: nameof(SA1633CodeFixProvider)), diagnostic);\n+            }\n+\n+            return SpecializedTasks.CompletedTask;\n+        }\n+\n+        private static async Task<Document> GetTransformedDocumentAsync(Document document, CancellationToken cancellationToken)\n+        {\n+            var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);\n+\n+            var fileHeader = FileHeaderHelpers.ParseFileHeader(root);\n+            SyntaxNode newSyntaxRoot;\n+            if (fileHeader.IsMissing)\n+            {\n+                newSyntaxRoot = AddHeader(root, document.Name);\n+            }\n+            else\n+            {\n+                newSyntaxRoot = ReplaceHeader(document, root);\n+            }\n+\n+            return document.WithSyntaxRoot(newSyntaxRoot);\n+        }\n+\n+        private static SyntaxNode ReplaceHeader(Document document, SyntaxNode root)\n+        {\n+            var existingTrivia = root.GetLeadingTrivia().Where(x => !x.IsKind(SyntaxKind.EndOfLineTrivia) && !x.IsKind(SyntaxKind.SingleLineCommentTrivia));","path":"StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1633CodeFixProvider.cs","position":69,"original_position":69,"commit_id":"2c103aa4364d70122bb7dc3454d02ff782e9ede6","original_commit_id":"2c103aa4364d70122bb7dc3454d02ff782e9ede6","user":{"login":"pdelvo","id":1710209,"avatar_url":"https://avatars.githubusercontent.com/u/1710209?v=3","gravatar_id":"","url":"https://api.github.com/users/pdelvo","html_url":"https://github.com/pdelvo","followers_url":"https://api.github.com/users/pdelvo/followers","following_url":"https://api.github.com/users/pdelvo/following{/other_user}","gists_url":"https://api.github.com/users/pdelvo/gists{/gist_id}","starred_url":"https://api.github.com/users/pdelvo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdelvo/subscriptions","organizations_url":"https://api.github.com/users/pdelvo/orgs","repos_url":"https://api.github.com/users/pdelvo/repos","events_url":"https://api.github.com/users/pdelvo/events{/privacy}","received_events_url":"https://api.github.com/users/pdelvo/received_events","type":"User","site_admin":false},"body":"This does not look right to me. What would happen here:\r\n```csharp\r\n// This is a bad header\r\n#region Some region\r\n// Some comments\r\n#region Some other region\r\n// Some more comments\r\n\r\nclass Foo { }\r\n#endregion\r\n#endregion\r\n```","created_at":"2015-08-23T01:40:34Z","updated_at":"2015-08-23T01:40:34Z","html_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/1237#discussion_r37701721","pull_request_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1237","_links":{"self":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/comments/37701721"},"html":{"href":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/1237#discussion_r37701721"},"pull_request":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1237"}}},"pull_request":{"url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1237","id":42615113,"html_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/1237","diff_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/1237.diff","patch_url":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/1237.patch","issue_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/1237","number":1237,"state":"open","locked":false,"title":"Fix for issue 1234","user":{"login":"hvanbakel","id":4130108,"avatar_url":"https://avatars.githubusercontent.com/u/4130108?v=3","gravatar_id":"","url":"https://api.github.com/users/hvanbakel","html_url":"https://github.com/hvanbakel","followers_url":"https://api.github.com/users/hvanbakel/followers","following_url":"https://api.github.com/users/hvanbakel/following{/other_user}","gists_url":"https://api.github.com/users/hvanbakel/gists{/gist_id}","starred_url":"https://api.github.com/users/hvanbakel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hvanbakel/subscriptions","organizations_url":"https://api.github.com/users/hvanbakel/orgs","repos_url":"https://api.github.com/users/hvanbakel/repos","events_url":"https://api.github.com/users/hvanbakel/events{/privacy}","received_events_url":"https://api.github.com/users/hvanbakel/received_events","type":"User","site_admin":false},"body":"Fix for issue #1234 ","created_at":"2015-08-17T17:52:55Z","updated_at":"2015-08-23T01:40:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d85ce17a4b8398c13dca1b5a091abff8aeaabd69","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1237/commits","review_comments_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1237/comments","review_comment_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/1237/comments","statuses_url":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/statuses/2c103aa4364d70122bb7dc3454d02ff782e9ede6","head":{"label":"hvanbakel:issue-1234","ref":"issue-1234","sha":"2c103aa4364d70122bb7dc3454d02ff782e9ede6","user":{"login":"hvanbakel","id":4130108,"avatar_url":"https://avatars.githubusercontent.com/u/4130108?v=3","gravatar_id":"","url":"https://api.github.com/users/hvanbakel","html_url":"https://github.com/hvanbakel","followers_url":"https://api.github.com/users/hvanbakel/followers","following_url":"https://api.github.com/users/hvanbakel/following{/other_user}","gists_url":"https://api.github.com/users/hvanbakel/gists{/gist_id}","starred_url":"https://api.github.com/users/hvanbakel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hvanbakel/subscriptions","organizations_url":"https://api.github.com/users/hvanbakel/orgs","repos_url":"https://api.github.com/users/hvanbakel/repos","events_url":"https://api.github.com/users/hvanbakel/events{/privacy}","received_events_url":"https://api.github.com/users/hvanbakel/received_events","type":"User","site_admin":false},"repo":{"id":40282840,"name":"StyleCopAnalyzers","full_name":"hvanbakel/StyleCopAnalyzers","owner":{"login":"hvanbakel","id":4130108,"avatar_url":"https://avatars.githubusercontent.com/u/4130108?v=3","gravatar_id":"","url":"https://api.github.com/users/hvanbakel","html_url":"https://github.com/hvanbakel","followers_url":"https://api.github.com/users/hvanbakel/followers","following_url":"https://api.github.com/users/hvanbakel/following{/other_user}","gists_url":"https://api.github.com/users/hvanbakel/gists{/gist_id}","starred_url":"https://api.github.com/users/hvanbakel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hvanbakel/subscriptions","organizations_url":"https://api.github.com/users/hvanbakel/orgs","repos_url":"https://api.github.com/users/hvanbakel/repos","events_url":"https://api.github.com/users/hvanbakel/events{/privacy}","received_events_url":"https://api.github.com/users/hvanbakel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hvanbakel/StyleCopAnalyzers","description":"An implementation of StyleCop rules using the .NET Compiler Platform","fork":true,"url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers","forks_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/forks","keys_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/teams","hooks_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/hooks","issue_events_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/issues/events{/number}","events_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/events","assignees_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/assignees{/user}","branches_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/branches{/branch}","tags_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/tags","blobs_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/git/refs{/sha}","trees_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/statuses/{sha}","languages_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/languages","stargazers_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/stargazers","contributors_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/contributors","subscribers_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/subscribers","subscription_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/subscription","commits_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/commits{/sha}","git_commits_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/git/commits{/sha}","comments_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/comments{/number}","issue_comment_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/issues/comments{/number}","contents_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/contents/{+path}","compare_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/merges","archive_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/downloads","issues_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/issues{/number}","pulls_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/pulls{/number}","milestones_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/milestones{/number}","notifications_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/labels{/name}","releases_url":"https://api.github.com/repos/hvanbakel/StyleCopAnalyzers/releases{/id}","created_at":"2015-08-06T03:42:39Z","updated_at":"2015-08-06T03:42:43Z","pushed_at":"2015-08-20T15:32:23Z","git_url":"git://github.com/hvanbakel/StyleCopAnalyzers.git","ssh_url":"git@github.com:hvanbakel/StyleCopAnalyzers.git","clone_url":"https://github.com/hvanbakel/StyleCopAnalyzers.git","svn_url":"https://github.com/hvanbakel/StyleCopAnalyzers","homepage":null,"size":4946,"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":"8f6be2054af08176813a505d2fd7cc15a593da5e","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-08-22T15:18:40Z","pushed_at":"2015-08-23T01:38:22Z","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":11297,"stargazers_count":164,"watchers_count":164,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":42,"mirror_url":null,"open_issues_count":163,"forks":42,"open_issues":163,"watchers":164,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1237"},"html":{"href":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/1237"},"issue":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/1237"},"comments":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/issues/1237/comments"},"review_comments":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1237/comments"},"review_comment":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/pulls/1237/commits"},"statuses":{"href":"https://api.github.com/repos/DotNetAnalyzers/StyleCopAnalyzers/statuses/2c103aa4364d70122bb7dc3454d02ff782e9ede6"}}}}