{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/comments/57380779","id":57380779,"diff_hunk":"@@ -4,45 +4,98 @@\n using Microsoft.CodeAnalysis;\n using Microsoft.CodeAnalysis.Diagnostics;\n using Analyzer.Utilities;\n+using System.Linq;\n+using Microsoft.CodeAnalysis.Semantics;\n \n namespace System.Runtime.Analyzers\n {\n     /// <summary>\n     /// CA1308: Normalize strings to uppercase\n+    /// <para>\n+    /// Strings should be normalized to uppercase. A small group of characters, when they are converted to lowercase, cannot make a round trip.\n+    /// To make a round trip means to convert the characters from one locale to another locale that represents character data differently,\n+    /// and then to accurately retrieve the original characters from the converted characters.\n+    /// </para>\n     /// </summary>\n-    public abstract class NormalizeStringsToUppercaseAnalyzer : DiagnosticAnalyzer\n+    [DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]\n+    public sealed class NormalizeStringsToUppercaseAnalyzer : DiagnosticAnalyzer\n     {\n         internal const string RuleId = \"CA1308\";\n \n         private static readonly LocalizableString s_localizableTitle = new LocalizableResourceString(nameof(SystemRuntimeAnalyzersResources.NormalizeStringsToUppercaseTitle), SystemRuntimeAnalyzersResources.ResourceManager, typeof(SystemRuntimeAnalyzersResources));\n \n-        private static readonly LocalizableString s_localizableMessageToUpperInvariant = new LocalizableResourceString(nameof(SystemRuntimeAnalyzersResources.NormalizeStringsToUppercaseMessageToUpperInvariant), SystemRuntimeAnalyzersResources.ResourceManager, typeof(SystemRuntimeAnalyzersResources));\n         private static readonly LocalizableString s_localizableMessageToUpper = new LocalizableResourceString(nameof(SystemRuntimeAnalyzersResources.NormalizeStringsToUppercaseMessageToUpper), SystemRuntimeAnalyzersResources.ResourceManager, typeof(SystemRuntimeAnalyzersResources));\n         private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(SystemRuntimeAnalyzersResources.NormalizeStringsToUppercaseDescription), SystemRuntimeAnalyzersResources.ResourceManager, typeof(SystemRuntimeAnalyzersResources));\n \n-        internal static DiagnosticDescriptor ToUpperInvariantRule = new DiagnosticDescriptor(RuleId,\n-                                                                             s_localizableTitle,\n-                                                                             s_localizableMessageToUpperInvariant,\n-                                                                             DiagnosticCategory.Naming,\n-                                                                             DiagnosticSeverity.Warning,\n-                                                                             isEnabledByDefault: false,\n-                                                                             description: s_localizableDescription,\n-                                                                             helpLinkUri: null,     // TODO: add MSDN url\n-                                                                             customTags: WellKnownDiagnosticTags.Telemetry);\n         internal static DiagnosticDescriptor ToUpperRule = new DiagnosticDescriptor(RuleId,\n                                                                              s_localizableTitle,\n                                                                              s_localizableMessageToUpper,\n-                                                                             DiagnosticCategory.Naming,\n+                                                                             DiagnosticCategory.Globalization,\n                                                                              DiagnosticSeverity.Warning,\n-                                                                             isEnabledByDefault: false,\n+                                                                             isEnabledByDefault: true,\n                                                                              description: s_localizableDescription,\n-                                                                             helpLinkUri: null,     // TODO: add MSDN url\n+                                                                             helpLinkUri: @\"https://msdn.microsoft.com/en-us/library/bb386042.aspx\",\n                                                                              customTags: WellKnownDiagnosticTags.Telemetry);\n \n-        public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(ToUpperInvariantRule, ToUpperRule);\n+        public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(ToUpperRule);\n \n         public override void Initialize(AnalysisContext analysisContext)\n         {\n+            analysisContext.RegisterCompilationStartAction(compilationStartContext =>\n+            {\n+                var stringType = WellKnownTypes.String(compilationStartContext.Compilation);\n+                if (stringType == null)\n+                {\n+                    return;\n+                }\n+\n+                var cultureInfo = compilationStartContext.Compilation.GetTypeByMetadataName(\"System.Globalization.CultureInfo\");\n+                var invariantCulture = cultureInfo?.GetMembers(\"InvariantCulture\").OfType<IPropertySymbol>().FirstOrDefault();","path":"src/System.Runtime.Analyzers/Core/NormalizeStringsToUppercase.cs","position":65,"original_position":65,"commit_id":"128d8c9e8103e409c73a92c5b1278e98048039e9","original_commit_id":"128d8c9e8103e409c73a92c5b1278e98048039e9","user":{"login":"mavasani","id":10605811,"avatar_url":"https://avatars.githubusercontent.com/u/10605811?v=3","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":"All code paths don't require culture info. More specifically, we want to flag call to String.ToLowerInvariant, which has no parameters.","created_at":"2016-03-24T20:16:05Z","updated_at":"2016-03-24T20:16:05Z","html_url":"https://github.com/dotnet/roslyn-analyzers/pull/886#discussion_r57380779","pull_request_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/886","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/comments/57380779"},"html":{"href":"https://github.com/dotnet/roslyn-analyzers/pull/886#discussion_r57380779"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/886"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/886","id":64086326,"html_url":"https://github.com/dotnet/roslyn-analyzers/pull/886","diff_url":"https://github.com/dotnet/roslyn-analyzers/pull/886.diff","patch_url":"https://github.com/dotnet/roslyn-analyzers/pull/886.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/issues/886","number":886,"state":"open","locked":false,"title":"Implement CA1308: NormalizeStringsToUppercase","user":{"login":"mavasani","id":10605811,"avatar_url":"https://avatars.githubusercontent.com/u/10605811?v=3","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":"Strings should be normalized to uppercase. A small group of characters, when they are converted to lowercase, cannot make a round trip. To make a round trip means to convert the characters from one locale to another locale that represents character data differently, and then to accurately retrieve the original characters from the converted characters.\r\n\r\nMSDN help: https://msdn.microsoft.com/en-us/library/bb386042.aspx\r\n\r\nTODO: Implement a fixer\r\n\r\nFixes https://github.com/dotnet/roslyn-analyzers/issues/416","created_at":"2016-03-24T19:30:04Z","updated_at":"2016-03-24T20:16:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"94dd577305ec883b6bba6a1cd70368b4c1efe815","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/886/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/886/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/886/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn-analyzers/statuses/128d8c9e8103e409c73a92c5b1278e98048039e9","head":{"label":"mavasani:CA1308","ref":"CA1308","sha":"128d8c9e8103e409c73a92c5b1278e98048039e9","user":{"login":"mavasani","id":10605811,"avatar_url":"https://avatars.githubusercontent.com/u/10605811?v=3","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},"repo":{"id":45504515,"name":"roslyn-analyzers","full_name":"mavasani/roslyn-analyzers","owner":{"login":"mavasani","id":10605811,"avatar_url":"https://avatars.githubusercontent.com/u/10605811?v=3","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},"private":false,"html_url":"https://github.com/mavasani/roslyn-analyzers","description":"","fork":true,"url":"https://api.github.com/repos/mavasani/roslyn-analyzers","forks_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/forks","keys_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/teams","hooks_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/hooks","issue_events_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/issues/events{/number}","events_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/events","assignees_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/assignees{/user}","branches_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/branches{/branch}","tags_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/tags","blobs_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/git/refs{/sha}","trees_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/statuses/{sha}","languages_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/languages","stargazers_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/stargazers","contributors_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/contributors","subscribers_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/subscribers","subscription_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/subscription","commits_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/commits{/sha}","git_commits_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/git/commits{/sha}","comments_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/comments{/number}","issue_comment_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/issues/comments{/number}","contents_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/contents/{+path}","compare_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/merges","archive_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/downloads","issues_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/issues{/number}","pulls_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/pulls{/number}","milestones_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/milestones{/number}","notifications_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/labels{/name}","releases_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/releases{/id}","deployments_url":"https://api.github.com/repos/mavasani/roslyn-analyzers/deployments","created_at":"2015-11-04T00:20:33Z","updated_at":"2016-02-23T11:20:01Z","pushed_at":"2016-03-24T19:26:48Z","git_url":"git://github.com/mavasani/roslyn-analyzers.git","ssh_url":"git@github.com:mavasani/roslyn-analyzers.git","clone_url":"https://github.com/mavasani/roslyn-analyzers.git","svn_url":"https://github.com/mavasani/roslyn-analyzers","homepage":null,"size":6547,"stargazers_count":1,"watchers_count":1,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"7e0691ffb160a70422d5f4da22034e49b55dbbf1","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-03-22T22:20:11Z","pushed_at":"2016-03-24T19:30:05Z","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":8300,"stargazers_count":82,"watchers_count":82,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":72,"mirror_url":null,"open_issues_count":181,"forks":72,"open_issues":181,"watchers":82,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/886"},"html":{"href":"https://github.com/dotnet/roslyn-analyzers/pull/886"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/issues/886"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/issues/886/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/pulls/886/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/886/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn-analyzers/statuses/128d8c9e8103e409c73a92c5b1278e98048039e9"}}}}