{"action":"created","comment":{"url":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls/comments/131611246","pull_request_review_id":54606703,"id":131611246,"diff_hunk":"@@ -0,0 +1,111 @@\n+/*\n+ * SonarAnalyzer for .NET\n+ * Copyright (C) 2015-2017 SonarSource SA\n+ * mailto: contact AT sonarsource DOT com\n+ *\n+ * This program is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU Lesser General Public\n+ * License as published by the Free Software Foundation; either\n+ * version 3 of the License, or (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+ * Lesser General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public License\n+ * along with this program; if not, write to the Free Software Foundation,\n+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n+ */\n+\n+using System.Collections.Generic;\n+using System.Collections.Immutable;\n+using System.Linq;\n+using Microsoft.CodeAnalysis;\n+using Microsoft.CodeAnalysis.CSharp;\n+using Microsoft.CodeAnalysis.CSharp.Syntax;\n+using Microsoft.CodeAnalysis.Diagnostics;\n+using SonarAnalyzer.Common;\n+using SonarAnalyzer.Helpers;\n+\n+namespace SonarAnalyzer.Rules.CSharp\n+{\n+    [DiagnosticAnalyzer(LanguageNames.CSharp)]\n+    [Rule(DiagnosticId)]\n+    public sealed class TestMethodShouldHaveCorrectSignature : SonarDiagnosticAnalyzer\n+    {\n+        internal const string DiagnosticId = \"S3433\";\n+        private const string MessageFormat = \"Make this test method {0}.\";\n+        private const string MakePublicMessage = \"'public'\";\n+        private const string MakeNonAsyncOrTaskMessage = \"non-'async' or return 'Task'\";\n+        private const string MakeNotGenericMessage = \"non-generic\";\n+\n+        private static readonly DiagnosticDescriptor rule =\n+            DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, RspecStrings.ResourceManager);\n+        public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(rule);\n+\n+        private static readonly ISet<KnownType> TrackedTestAttributes = ImmutableHashSet.Create(\n+            KnownType.Microsoft_VisualStudio_TestTools_UnitTesting_TestMethodAttribute,\n+            KnownType.NUnit_Framework_TestAttribute,\n+            KnownType.Xunit_FactAttribute);\n+\n+        protected override void Initialize(SonarAnalysisContext context)\n+        {\n+            context.RegisterSyntaxNodeActionInNonGenerated(\n+                c =>\n+                {\n+                    if (!c.IsTest())\n+                    {\n+                        return;\n+                    }\n+\n+                    var classDeclaration = (ClassDeclarationSyntax)c.Node;\n+                    var classSymbol = c.SemanticModel.GetDeclaredSymbol(classDeclaration);\n+                    if (classSymbol == null)\n+                    {\n+                        return;\n+                    }\n+\n+                    var allFaultyMethods = classSymbol.GetMembers()\n+                        .OfType<IMethodSymbol>()\n+                        .Where(IsTestMethod)\n+                        .Select(method => new\n+                        {\n+                            Location = method.Locations.First(),\n+                            Message = GetFaults(method).ToSentence()\n+                        })\n+                        .Where(tuple => tuple.Message != null);\n+\n+                    foreach (var faultyMethod in allFaultyMethods)\n+                    {\n+                        c.ReportDiagnostic(Diagnostic.Create(rule, faultyMethod.Location,\n+                            faultyMethod.Message));\n+                    }\n+                },\n+                SyntaxKind.ClassDeclaration);\n+        }\n+\n+        private static bool IsTestMethod(IMethodSymbol method)","path":"sonaranalyzer-dotnet/src/SonarAnalyzer.CSharp/Rules/TestMethodShouldHaveCorrectSignature.cs","position":88,"original_position":88,"commit_id":"41262825cd715b6160b31ee406433ea42b13916b","original_commit_id":"41262825cd715b6160b31ee406433ea42b13916b","user":{"login":"SonarTech","id":1842438,"avatar_url":"https://avatars2.githubusercontent.com/u/1842438?v=4","gravatar_id":"","url":"https://api.github.com/users/SonarTech","html_url":"https://github.com/SonarTech","followers_url":"https://api.github.com/users/SonarTech/followers","following_url":"https://api.github.com/users/SonarTech/following{/other_user}","gists_url":"https://api.github.com/users/SonarTech/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarTech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarTech/subscriptions","organizations_url":"https://api.github.com/users/SonarTech/orgs","repos_url":"https://api.github.com/users/SonarTech/repos","events_url":"https://api.github.com/users/SonarTech/events{/privacy}","received_events_url":"https://api.github.com/users/SonarTech/received_events","type":"User","site_admin":false},"body":"![MINOR](https://sonarsource.github.io/sonar-github/severity-minor.png 'Severity: MINOR') Consider using more general type 'Microsoft.CodeAnalysis.ISymbol' instead of 'Microsoft.CodeAnalysis.IMethodSymbol'. [![rule](https://sonarsource.github.io/sonar-github/rule.png)](https://next.sonarqube.com/sonarqube/coding_rules#rule_key=csharpsquid%3AS3242)\n","created_at":"2017-08-07T09:32:07Z","updated_at":"2017-08-07T09:32:08Z","html_url":"https://github.com/SonarSource/sonar-csharp/pull/646#discussion_r131611246","pull_request_url":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls/646","_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls/comments/131611246"},"html":{"href":"https://github.com/SonarSource/sonar-csharp/pull/646#discussion_r131611246"},"pull_request":{"href":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls/646"}}},"pull_request":{"url":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls/646","id":133959148,"html_url":"https://github.com/SonarSource/sonar-csharp/pull/646","diff_url":"https://github.com/SonarSource/sonar-csharp/pull/646.diff","patch_url":"https://github.com/SonarSource/sonar-csharp/pull/646.patch","issue_url":"https://api.github.com/repos/SonarSource/sonar-csharp/issues/646","number":646,"state":"open","locked":false,"title":"Rule S3433: Test methods should have correct signature","user":{"login":"Evangelink","id":11340282,"avatar_url":"https://avatars0.githubusercontent.com/u/11340282?v=4","gravatar_id":"","url":"https://api.github.com/users/Evangelink","html_url":"https://github.com/Evangelink","followers_url":"https://api.github.com/users/Evangelink/followers","following_url":"https://api.github.com/users/Evangelink/following{/other_user}","gists_url":"https://api.github.com/users/Evangelink/gists{/gist_id}","starred_url":"https://api.github.com/users/Evangelink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Evangelink/subscriptions","organizations_url":"https://api.github.com/users/Evangelink/orgs","repos_url":"https://api.github.com/users/Evangelink/repos","events_url":"https://api.github.com/users/Evangelink/events{/privacy}","received_events_url":"https://api.github.com/users/Evangelink/received_events","type":"User","site_admin":false},"body":"Fix #626","created_at":"2017-08-03T14:29:54Z","updated_at":"2017-08-07T09:32:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"501b2958c3c8a9b30eb29cb1e0e24b6cc9e3de1b","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls/646/commits","review_comments_url":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls/646/comments","review_comment_url":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SonarSource/sonar-csharp/issues/646/comments","statuses_url":"https://api.github.com/repos/SonarSource/sonar-csharp/statuses/41262825cd715b6160b31ee406433ea42b13916b","head":{"label":"SonarSource:rule-S3433","ref":"rule-S3433","sha":"41262825cd715b6160b31ee406433ea42b13916b","user":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars0.githubusercontent.com/u/545988?v=4","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"repo":{"id":5582516,"name":"sonar-csharp","full_name":"SonarSource/sonar-csharp","owner":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars0.githubusercontent.com/u/545988?v=4","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SonarSource/sonar-csharp","description":"Code analyzer for C# projects","fork":false,"url":"https://api.github.com/repos/SonarSource/sonar-csharp","forks_url":"https://api.github.com/repos/SonarSource/sonar-csharp/forks","keys_url":"https://api.github.com/repos/SonarSource/sonar-csharp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonar-csharp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonar-csharp/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonar-csharp/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonar-csharp/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonar-csharp/events","assignees_url":"https://api.github.com/repos/SonarSource/sonar-csharp/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonar-csharp/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonar-csharp/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonar-csharp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonar-csharp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonar-csharp/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonar-csharp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonar-csharp/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonar-csharp/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonar-csharp/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonar-csharp/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonar-csharp/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonar-csharp/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonar-csharp/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonar-csharp/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonar-csharp/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonar-csharp/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonar-csharp/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonar-csharp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonar-csharp/merges","archive_url":"https://api.github.com/repos/SonarSource/sonar-csharp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonar-csharp/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonar-csharp/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonar-csharp/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonar-csharp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonar-csharp/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonar-csharp/releases{/id}","deployments_url":"https://api.github.com/repos/SonarSource/sonar-csharp/deployments","created_at":"2012-08-28T07:37:28Z","updated_at":"2017-08-07T06:15:27Z","pushed_at":"2017-08-07T09:24:57Z","git_url":"git://github.com/SonarSource/sonar-csharp.git","ssh_url":"git@github.com:SonarSource/sonar-csharp.git","clone_url":"https://github.com/SonarSource/sonar-csharp.git","svn_url":"https://github.com/SonarSource/sonar-csharp","homepage":"https://redirect.sonarsource.com/plugins/csharp.html","size":54518,"stargazers_count":95,"watchers_count":95,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":78,"mirror_url":null,"open_issues_count":73,"forks":78,"open_issues":73,"watchers":95,"default_branch":"master"}},"base":{"label":"SonarSource:master","ref":"master","sha":"103247815c9fabdc74a20305c24b6044a558059d","user":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars0.githubusercontent.com/u/545988?v=4","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"repo":{"id":5582516,"name":"sonar-csharp","full_name":"SonarSource/sonar-csharp","owner":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars0.githubusercontent.com/u/545988?v=4","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SonarSource/sonar-csharp","description":"Code analyzer for C# projects","fork":false,"url":"https://api.github.com/repos/SonarSource/sonar-csharp","forks_url":"https://api.github.com/repos/SonarSource/sonar-csharp/forks","keys_url":"https://api.github.com/repos/SonarSource/sonar-csharp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonar-csharp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonar-csharp/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonar-csharp/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonar-csharp/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonar-csharp/events","assignees_url":"https://api.github.com/repos/SonarSource/sonar-csharp/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonar-csharp/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonar-csharp/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonar-csharp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonar-csharp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonar-csharp/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonar-csharp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonar-csharp/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonar-csharp/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonar-csharp/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonar-csharp/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonar-csharp/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonar-csharp/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonar-csharp/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonar-csharp/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonar-csharp/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonar-csharp/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonar-csharp/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonar-csharp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonar-csharp/merges","archive_url":"https://api.github.com/repos/SonarSource/sonar-csharp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonar-csharp/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonar-csharp/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonar-csharp/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonar-csharp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonar-csharp/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonar-csharp/releases{/id}","deployments_url":"https://api.github.com/repos/SonarSource/sonar-csharp/deployments","created_at":"2012-08-28T07:37:28Z","updated_at":"2017-08-07T06:15:27Z","pushed_at":"2017-08-07T09:24:57Z","git_url":"git://github.com/SonarSource/sonar-csharp.git","ssh_url":"git@github.com:SonarSource/sonar-csharp.git","clone_url":"https://github.com/SonarSource/sonar-csharp.git","svn_url":"https://github.com/SonarSource/sonar-csharp","homepage":"https://redirect.sonarsource.com/plugins/csharp.html","size":54518,"stargazers_count":95,"watchers_count":95,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":78,"mirror_url":null,"open_issues_count":73,"forks":78,"open_issues":73,"watchers":95,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls/646"},"html":{"href":"https://github.com/SonarSource/sonar-csharp/pull/646"},"issue":{"href":"https://api.github.com/repos/SonarSource/sonar-csharp/issues/646"},"comments":{"href":"https://api.github.com/repos/SonarSource/sonar-csharp/issues/646/comments"},"review_comments":{"href":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls/646/comments"},"review_comment":{"href":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SonarSource/sonar-csharp/pulls/646/commits"},"statuses":{"href":"https://api.github.com/repos/SonarSource/sonar-csharp/statuses/41262825cd715b6160b31ee406433ea42b13916b"}}}}
{"actor":{"display_login":"SonarTech"}}