{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/comments/224869684","pull_request_review_id":164349401,"id":224869684,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNDg2OTY4NA==","diff_hunk":"@@ -0,0 +1,153 @@\n+﻿using System;\n+using System.Collections.Immutable;\n+using System.Composition;\n+using System.Linq;\n+using System.Threading;\n+using System.Threading.Tasks;\n+\n+using Analyzer.Utilities;\n+\n+using Microsoft.CodeAnalysis;\n+using Microsoft.CodeAnalysis.CodeFixes;\n+using Microsoft.CodeAnalysis.CSharp.Syntax;\n+using Microsoft.CodeAnalysis.Editing;\n+\n+namespace Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines\n+{\n+    // TODO: VisualBasic as well?\n+    [ExportCodeFixProvider(LanguageNames.CSharp, LanguageNames.VisualBasic), Shared]\n+    public sealed class StringBuilderAppendShouldNotTakeSubstringFixer : CodeFixProvider\n+    {\n+        public sealed override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray\n+            .Create(\n+                StringBuilderAppendShouldNotTakeSubstring.RuleIdOneParameterId,\n+                StringBuilderAppendShouldNotTakeSubstring.RuleIdTwoParameterId);\n+\n+        public sealed override FixAllProvider GetFixAllProvider()\n+        {\n+            return WellKnownFixAllProviders.BatchFixer;\n+        }\n+\n+        public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)\n+        {\n+            SyntaxNode root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);\n+            SyntaxNode node = root.FindNode(context.Span);\n+\n+            // TODO is it guaranteed that there's only one at once?\n+            Diagnostic diagnostic = context.Diagnostics.Single();","path":"src/Microsoft.CodeQuality.Analyzers/Core/ApiDesignGuidelines/StringBuilderAppendShouldNotTakeSubstring.Fixer.cs","position":37,"original_position":37,"commit_id":"f1b5102218bfe0cda47b5cece6399faaee8638d0","original_commit_id":"f1b5102218bfe0cda47b5cece6399faaee8638d0","user":{"login":"mavasani","id":10605811,"node_id":"MDQ6VXNlcjEwNjA1ODEx","avatar_url":"https://avatars2.githubusercontent.com/u/10605811?v=4","gravatar_id":"","url":"https://api.github.com/users/mavasani","html_url":"https://github.com/mavasani","followers_url":"https://api.github.com/users/mavasani/followers","following_url":"https://api.github.com/users/mavasani/following{/other_user}","gists_url":"https://api.github.com/users/mavasani/gists{/gist_id}","starred_url":"https://api.github.com/users/mavasani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mavasani/subscriptions","organizations_url":"https://api.github.com/users/mavasani/orgs","repos_url":"https://api.github.com/users/mavasani/repos","events_url":"https://api.github.com/users/mavasani/events{/privacy}","received_events_url":"https://api.github.com/users/mavasani/received_events","type":"User","site_admin":false},"body":"See this comment for details: https://github.com/dotnet/roslyn/pull/30093#issuecomment-424145149\r\n\r\nGist:\r\n```\r\nIn short, majority of fixers should take the following approach:\r\n1. Operate on the first diagnostic from the code fix context.\r\n2. Have defensive checks for the syntax kind to which a diagnostic span maps, and bail out for unexpected cases.\r\n3. Use the first diagnostic for RegisterCodeFix invocation.\r\n```","created_at":"2018-10-12T17:59:29Z","updated_at":"2018-10-12T17:59:29Z","html_url":"https://github.com/dotnet/roslyn-analyzers/pull/1854#discussion_r224869684","pull_request_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/1854","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/comments/224869684"},"html":{"href":"https://github.com/dotnet/roslyn-analyzers/pull/1854#discussion_r224869684"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/1854"}},"in_reply_to_id":224674582},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/1854","id":222290001,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyMjkwMDAx","html_url":"https://github.com/dotnet/roslyn-analyzers/pull/1854","diff_url":"https://github.com/dotnet/roslyn-analyzers/pull/1854.diff","patch_url":"https://github.com/dotnet/roslyn-analyzers/pull/1854.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/issues/1854","number":1854,"state":"open","locked":false,"title":"[WIP] #1638: analyzer & fixer implementation as well as first happy-path tests","user":{"login":"jongleur1983","id":2063360,"node_id":"MDQ6VXNlcjIwNjMzNjA=","avatar_url":"https://avatars3.githubusercontent.com/u/2063360?v=4","gravatar_id":"","url":"https://api.github.com/users/jongleur1983","html_url":"https://github.com/jongleur1983","followers_url":"https://api.github.com/users/jongleur1983/followers","following_url":"https://api.github.com/users/jongleur1983/following{/other_user}","gists_url":"https://api.github.com/users/jongleur1983/gists{/gist_id}","starred_url":"https://api.github.com/users/jongleur1983/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jongleur1983/subscriptions","organizations_url":"https://api.github.com/users/jongleur1983/orgs","repos_url":"https://api.github.com/users/jongleur1983/repos","events_url":"https://api.github.com/users/jongleur1983/events{/privacy}","received_events_url":"https://api.github.com/users/jongleur1983/received_events","type":"User","site_admin":false},"body":"Implemented the analyzer proposed in #1638 and would like to get some help for how to proceed, as it's my first analyzer.\r\n\r\nMissing yet:\r\n1. resources have no real values (I don't have a good idea on what to use here, perhaps @Therzok has an idea as he proposed the functionality?)\r\n1. RuleIds might have to be changed?\r\n1. HelpLinkUri's are missing for the two rules (might be the same, but the documentation is missing as well, yet)\r\n1. VB variant not working: I wrote the unit tests for it, but I'm not a VB coder, so I simply converted the C# code to VB to provide the same unit tests for VB. Those tests fail, and from the result it looks like it's really doing something wrong for the VB code. I may just disable VB for now, but if anyone can help I'm happy to solve it as well.\r\n1. FixAll not working properly: this is harder than it looks like obviously, but I have no idea what's going wrong. Again: could be disabled easily (but I'd like to know instead, how to fix it, if possible)\r\n1. There are more unit tests required\r\n\r\nAll in all I'd like to get some input on what could be done better or worse.\r\nNot speficially minor issues like naming or code style; but more about API and roslyn logic stuff.","created_at":"2018-10-11T21:49:08Z","updated_at":"2018-10-12T17:59:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d8ea6d7ee93759c343dd1ef1da9d4eff307ae6a1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/1854/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/1854/comments","review_comment_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/issues/1854/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/statuses/f1b5102218bfe0cda47b5cece6399faaee8638d0","head":{"label":"jongleur1983:1638-SimplifyStringBuilderAppendSubStringAnalyzer","ref":"1638-SimplifyStringBuilderAppendSubStringAnalyzer","sha":"f1b5102218bfe0cda47b5cece6399faaee8638d0","user":{"login":"jongleur1983","id":2063360,"node_id":"MDQ6VXNlcjIwNjMzNjA=","avatar_url":"https://avatars3.githubusercontent.com/u/2063360?v=4","gravatar_id":"","url":"https://api.github.com/users/jongleur1983","html_url":"https://github.com/jongleur1983","followers_url":"https://api.github.com/users/jongleur1983/followers","following_url":"https://api.github.com/users/jongleur1983/following{/other_user}","gists_url":"https://api.github.com/users/jongleur1983/gists{/gist_id}","starred_url":"https://api.github.com/users/jongleur1983/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jongleur1983/subscriptions","organizations_url":"https://api.github.com/users/jongleur1983/orgs","repos_url":"https://api.github.com/users/jongleur1983/repos","events_url":"https://api.github.com/users/jongleur1983/events{/privacy}","received_events_url":"https://api.github.com/users/jongleur1983/received_events","type":"User","site_admin":false},"repo":{"id":152658547,"node_id":"MDEwOlJlcG9zaXRvcnkxNTI2NTg1NDc=","name":"roslyn-analyzers","full_name":"jongleur1983/roslyn-analyzers","private":false,"owner":{"login":"jongleur1983","id":2063360,"node_id":"MDQ6VXNlcjIwNjMzNjA=","avatar_url":"https://avatars3.githubusercontent.com/u/2063360?v=4","gravatar_id":"","url":"https://api.github.com/users/jongleur1983","html_url":"https://github.com/jongleur1983","followers_url":"https://api.github.com/users/jongleur1983/followers","following_url":"https://api.github.com/users/jongleur1983/following{/other_user}","gists_url":"https://api.github.com/users/jongleur1983/gists{/gist_id}","starred_url":"https://api.github.com/users/jongleur1983/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jongleur1983/subscriptions","organizations_url":"https://api.github.com/users/jongleur1983/orgs","repos_url":"https://api.github.com/users/jongleur1983/repos","events_url":"https://api.github.com/users/jongleur1983/events{/privacy}","received_events_url":"https://api.github.com/users/jongleur1983/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jongleur1983/roslyn-analyzers","description":null,"fork":true,"url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers","forks_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/forks","keys_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/teams","hooks_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/hooks","issue_events_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/issues/events{/number}","events_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/events","assignees_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/assignees{/user}","branches_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/branches{/branch}","tags_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/tags","blobs_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/git/refs{/sha}","trees_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/statuses/{sha}","languages_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/languages","stargazers_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/stargazers","contributors_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/contributors","subscribers_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/subscribers","subscription_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/subscription","commits_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/commits{/sha}","git_commits_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/git/commits{/sha}","comments_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/comments{/number}","issue_comment_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/issues/comments{/number}","contents_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/contents/{+path}","compare_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/merges","archive_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/downloads","issues_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/issues{/number}","pulls_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/pulls{/number}","milestones_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/milestones{/number}","notifications_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/labels{/name}","releases_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/releases{/id}","deployments_url":"https://api.github.com/repos/jongleur1983/roslyn-analyzers/deployments","created_at":"2018-10-11T21:32:45Z","updated_at":"2018-10-11T21:32:52Z","pushed_at":"2018-10-11T21:39:43Z","git_url":"git://github.com/jongleur1983/roslyn-analyzers.git","ssh_url":"git@github.com:jongleur1983/roslyn-analyzers.git","clone_url":"https://github.com/jongleur1983/roslyn-analyzers.git","svn_url":"https://github.com/jongleur1983/roslyn-analyzers","homepage":null,"size":15326,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"90dd082467b0a19daa1c6ec81e5bf036ae36806f","user":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":36946704,"node_id":"MDEwOlJlcG9zaXRvcnkzNjk0NjcwNA==","name":"roslyn-analyzers","full_name":"dotnet/roslyn-analyzers","private":false,"owner":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dotnet/roslyn-analyzers","description":null,"fork":false,"url":"https://api.github.com/repos/dotnet/roslyn-analyzers","forks_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/forks","keys_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/teams","hooks_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/hooks","issue_events_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/events","assignees_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/tags","blobs_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/languages","stargazers_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/stargazers","contributors_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/contributors","subscribers_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/subscribers","subscription_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/subscription","commits_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/merges","archive_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/downloads","issues_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/deployments","created_at":"2015-06-05T17:48:07Z","updated_at":"2018-10-12T06:30:02Z","pushed_at":"2018-10-12T09:05:27Z","git_url":"git://github.com/dotnet/roslyn-analyzers.git","ssh_url":"git@github.com:dotnet/roslyn-analyzers.git","clone_url":"https://github.com/dotnet/roslyn-analyzers.git","svn_url":"https://github.com/dotnet/roslyn-analyzers","homepage":null,"size":15313,"stargazers_count":377,"watchers_count":377,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":146,"mirror_url":null,"archived":false,"open_issues_count":336,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":146,"open_issues":336,"watchers":377,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/1854"},"html":{"href":"https://github.com/dotnet/roslyn-analyzers/pull/1854"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/issues/1854"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/issues/1854/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/1854/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/1854/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/statuses/f1b5102218bfe0cda47b5cece6399faaee8638d0"}},"author_association":"NONE"}}
{"actor":{"display_login":"mavasani"}}