{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/comments/50797015","id":50797015,"diff_hunk":"@@ -0,0 +1,59 @@\n+// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.\n+\n+using System.Collections.Immutable;\n+using Microsoft.CodeAnalysis;\n+using Microsoft.CodeAnalysis.Diagnostics;\n+using Analyzer.Utilities;\n+\n+namespace Microsoft.ApiDesignGuidelines.Analyzers\n+{\n+    /// <summary>\n+    /// CA1043: Use Integral Or String Argument For Indexers\n+    /// </summary>\n+    [DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]\n+    public sealed class UseIntegralOrStringArgumentForIndexersAnalyzer : DiagnosticAnalyzer\n+    {\n+        internal const string RuleId = \"CA1043\";\n+\n+        private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(MicrosoftApiDesignGuidelinesAnalyzersResources.UseIntegralOrStringArgumentForIndexersTitle), MicrosoftApiDesignGuidelinesAnalyzersResources.ResourceManager, typeof(MicrosoftApiDesignGuidelinesAnalyzersResources));\n+\n+        private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(MicrosoftApiDesignGuidelinesAnalyzersResources.UseIntegralOrStringArgumentForIndexersMessage), MicrosoftApiDesignGuidelinesAnalyzersResources.ResourceManager, typeof(MicrosoftApiDesignGuidelinesAnalyzersResources));\n+        private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(MicrosoftApiDesignGuidelinesAnalyzersResources.UseIntegralOrStringArgumentForIndexersDescription), MicrosoftApiDesignGuidelinesAnalyzersResources.ResourceManager, typeof(MicrosoftApiDesignGuidelinesAnalyzersResources));\n+\n+        internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(RuleId,\n+                                                                             s_localizableTitle,\n+                                                                             s_localizableMessage,\n+                                                                             DiagnosticCategory.Performance,\n+                                                                             DiagnosticSeverity.Warning,\n+                                                                             isEnabledByDefault: true,\n+                                                                             description: s_localizableDescription,\n+                                                                             helpLinkUri: \"https://msdn.microsoft.com/en-us/library/ms182180.aspx\",\n+                                                                             customTags: WellKnownDiagnosticTags.Telemetry);\n+\n+        public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule);\n+\n+        public override void Initialize(AnalysisContext analysisContext)\n+        {\n+            analysisContext.RegisterSymbolAction(AnalyzeSymbol, SymbolKind.Property );\n+\n+        }\n+\n+        private void AnalyzeSymbol(SymbolAnalysisContext context)\n+        {\n+            var symbol = (IPropertySymbol)context.Symbol;\n+            if (symbol.IsIndexer && !symbol.IsOverride)\n+            {\n+                if (symbol.GetParameters().Length == 1)\n+                {\n+                    var paramType = symbol.GetParameters()[0].Type;\n+                    var allowedTypes = (paramType.SpecialType == SpecialType.System_String || paramType.SpecialType == SpecialType.System_Int32 || paramType.SpecialType == SpecialType.System_Int16 || paramType.SpecialType == SpecialType.System_Int64 || paramType.SpecialType == SpecialType.System_Object);","path":"src/Microsoft.ApiDesignGuidelines.Analyzers/Core/UseIntegralOrStringArgumentForIndexers.cs","position":49,"original_position":49,"commit_id":"88e0d0fb3dccbf06c26593d660c58a9145b991b9","original_commit_id":"88e0d0fb3dccbf06c26593d660c58a9145b991b9","user":{"login":"srivatsn","id":20570,"avatar_url":"https://avatars.githubusercontent.com/u/20570?v=3","gravatar_id":"","url":"https://api.github.com/users/srivatsn","html_url":"https://github.com/srivatsn","followers_url":"https://api.github.com/users/srivatsn/followers","following_url":"https://api.github.com/users/srivatsn/following{/other_user}","gists_url":"https://api.github.com/users/srivatsn/gists{/gist_id}","starred_url":"https://api.github.com/users/srivatsn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srivatsn/subscriptions","organizations_url":"https://api.github.com/users/srivatsn/orgs","repos_url":"https://api.github.com/users/srivatsn/repos","events_url":"https://api.github.com/users/srivatsn/events{/privacy}","received_events_url":"https://api.github.com/users/srivatsn/received_events","type":"User","site_admin":false},"body":"Alternatively, you could store all the allowedTypes in an array and then simply call `if(allowedTypes.Contains(paramType.SpecialType))` so that extending the list is easier.","created_at":"2016-01-26T05:33:01Z","updated_at":"2016-01-26T05:33:01Z","html_url":"https://github.com/dotnet/roslyn-analyzers/pull/804#discussion_r50797015","pull_request_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/804","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/comments/50797015"},"html":{"href":"https://github.com/dotnet/roslyn-analyzers/pull/804#discussion_r50797015"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/804"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/804","id":56568347,"html_url":"https://github.com/dotnet/roslyn-analyzers/pull/804","diff_url":"https://github.com/dotnet/roslyn-analyzers/pull/804.diff","patch_url":"https://github.com/dotnet/roslyn-analyzers/pull/804.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/issues/804","number":804,"state":"open","locked":false,"title":"add and implement Analyzer Rule CA1043 and unit test","user":{"login":"maggiemsft","id":15161045,"avatar_url":"https://avatars.githubusercontent.com/u/15161045?v=3","gravatar_id":"","url":"https://api.github.com/users/maggiemsft","html_url":"https://github.com/maggiemsft","followers_url":"https://api.github.com/users/maggiemsft/followers","following_url":"https://api.github.com/users/maggiemsft/following{/other_user}","gists_url":"https://api.github.com/users/maggiemsft/gists{/gist_id}","starred_url":"https://api.github.com/users/maggiemsft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maggiemsft/subscriptions","organizations_url":"https://api.github.com/users/maggiemsft/orgs","repos_url":"https://api.github.com/users/maggiemsft/repos","events_url":"https://api.github.com/users/maggiemsft/events{/privacy}","received_events_url":"https://api.github.com/users/maggiemsft/received_events","type":"User","site_admin":false},"body":"Try to add and implement C# Analyzer Rule CA1043 and C# unit test, this is also Boot Camp assignment. \r\nThe meta data for this rule is not generated yet, so tried to add it and make it pass the build and unit test. \r\ncc @srivatsn \r\ncc @Anniepoh\r\n\r\nAppreciate review and comment.","created_at":"2016-01-20T06:17:23Z","updated_at":"2016-01-26T05:33:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/804/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/804/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/804/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/statuses/88e0d0fb3dccbf06c26593d660c58a9145b991b9","head":{"label":"maggiemsft:masun-ca1043","ref":"masun-ca1043","sha":"88e0d0fb3dccbf06c26593d660c58a9145b991b9","user":{"login":"maggiemsft","id":15161045,"avatar_url":"https://avatars.githubusercontent.com/u/15161045?v=3","gravatar_id":"","url":"https://api.github.com/users/maggiemsft","html_url":"https://github.com/maggiemsft","followers_url":"https://api.github.com/users/maggiemsft/followers","following_url":"https://api.github.com/users/maggiemsft/following{/other_user}","gists_url":"https://api.github.com/users/maggiemsft/gists{/gist_id}","starred_url":"https://api.github.com/users/maggiemsft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maggiemsft/subscriptions","organizations_url":"https://api.github.com/users/maggiemsft/orgs","repos_url":"https://api.github.com/users/maggiemsft/repos","events_url":"https://api.github.com/users/maggiemsft/events{/privacy}","received_events_url":"https://api.github.com/users/maggiemsft/received_events","type":"User","site_admin":false},"repo":{"id":49990207,"name":"roslyn-analyzers","full_name":"maggiemsft/roslyn-analyzers","owner":{"login":"maggiemsft","id":15161045,"avatar_url":"https://avatars.githubusercontent.com/u/15161045?v=3","gravatar_id":"","url":"https://api.github.com/users/maggiemsft","html_url":"https://github.com/maggiemsft","followers_url":"https://api.github.com/users/maggiemsft/followers","following_url":"https://api.github.com/users/maggiemsft/following{/other_user}","gists_url":"https://api.github.com/users/maggiemsft/gists{/gist_id}","starred_url":"https://api.github.com/users/maggiemsft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maggiemsft/subscriptions","organizations_url":"https://api.github.com/users/maggiemsft/orgs","repos_url":"https://api.github.com/users/maggiemsft/repos","events_url":"https://api.github.com/users/maggiemsft/events{/privacy}","received_events_url":"https://api.github.com/users/maggiemsft/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/maggiemsft/roslyn-analyzers","description":"","fork":true,"url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers","forks_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/forks","keys_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/teams","hooks_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/hooks","issue_events_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/issues/events{/number}","events_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/events","assignees_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/assignees{/user}","branches_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/branches{/branch}","tags_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/tags","blobs_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/git/refs{/sha}","trees_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/statuses/{sha}","languages_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/languages","stargazers_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/stargazers","contributors_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/contributors","subscribers_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/subscribers","subscription_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/subscription","commits_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/commits{/sha}","git_commits_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/git/commits{/sha}","comments_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/comments{/number}","issue_comment_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/issues/comments{/number}","contents_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/contents/{+path}","compare_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/merges","archive_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/downloads","issues_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/issues{/number}","pulls_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/pulls{/number}","milestones_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/milestones{/number}","notifications_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/labels{/name}","releases_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/releases{/id}","deployments_url":"https://api.github.com/repos/maggiemsft/roslyn-analyzers/deployments","created_at":"2016-01-19T23:23:00Z","updated_at":"2016-01-19T23:23:04Z","pushed_at":"2016-01-26T02:47:24Z","git_url":"git://github.com/maggiemsft/roslyn-analyzers.git","ssh_url":"git@github.com:maggiemsft/roslyn-analyzers.git","clone_url":"https://github.com/maggiemsft/roslyn-analyzers.git","svn_url":"https://github.com/maggiemsft/roslyn-analyzers","homepage":null,"size":5259,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"e213d92da2e00651ab9ca903f69b71984f7e626e","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","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,"name":"roslyn-analyzers","full_name":"dotnet/roslyn-analyzers","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","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},"private":false,"html_url":"https://github.com/dotnet/roslyn-analyzers","description":"","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":"2016-01-22T09:48:40Z","pushed_at":"2016-01-26T02:24:48Z","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":7171,"stargazers_count":71,"watchers_count":71,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":58,"mirror_url":null,"open_issues_count":175,"forks":58,"open_issues":175,"watchers":71,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/804"},"html":{"href":"https://github.com/dotnet/roslyn-analyzers/pull/804"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/issues/804"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/issues/804/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/804/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/804/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/statuses/88e0d0fb3dccbf06c26593d660c58a9145b991b9"}}}}