diff --git a/analyzers/its/expected/Automapper/S1694-AutoMapper-net461.json b/analyzers/its/expected/Automapper/S1694-AutoMapper-net461.json deleted file mode 100644 index 57bf1df0c07..00000000000 --- a/analyzers/its/expected/Automapper/S1694-AutoMapper-net461.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/AutoMapper/src/AutoMapper/Configuration/Profile.cs#L64", - "Location": "Line 64 Position 27-34" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/AutoMapper/src/AutoMapper/Execution/ProxyGenerator.cs#L169", - "Location": "Line 169 Position 27-36" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/Automapper/S1694-AutoMapper-netstandard2.0.json b/analyzers/its/expected/Automapper/S1694-AutoMapper-netstandard2.0.json deleted file mode 100644 index 57bf1df0c07..00000000000 --- a/analyzers/its/expected/Automapper/S1694-AutoMapper-netstandard2.0.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/AutoMapper/src/AutoMapper/Configuration/Profile.cs#L64", - "Location": "Line 64 Position 27-34" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/AutoMapper/src/AutoMapper/Execution/ProxyGenerator.cs#L169", - "Location": "Line 169 Position 27-36" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/CSharpLatest/S1694-CSharpLatest-net8.0.json b/analyzers/its/expected/CSharpLatest/S1694-CSharpLatest-net8.0.json index 97e54d20932..86a8b6a1c32 100644 --- a/analyzers/its/expected/CSharpLatest/S1694-CSharpLatest-net8.0.json +++ b/analyzers/its/expected/CSharpLatest/S1694-CSharpLatest-net8.0.json @@ -11,12 +11,6 @@ "Message": "Convert this \u0027abstract\u0027 record to an interface.", "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/CSharpLatest/CSharpLatest/CSharp9Features/Records.cs#L35", "Location": "Line 35 Position 24-38" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/CSharpLatest/CSharpLatest/CSharp9Features/S3240.cs#L5", - "Location": "Line 5 Position 20-25" } ] } \ No newline at end of file diff --git a/analyzers/its/expected/CSharpLatest/S1694-Net5-net5.0.json b/analyzers/its/expected/CSharpLatest/S1694-Net5-net5.0.json deleted file mode 100644 index 68f76b64e32..00000000000 --- a/analyzers/its/expected/CSharpLatest/S1694-Net5-net5.0.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/CSharpLatest/Net5/S2330.cs#L5", - "Location": "Line 5 Position 32-37" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/Nancy/S1694-Nancy-net452.json b/analyzers/its/expected/Nancy/S1694-Nancy-net452.json deleted file mode 100644 index 042a7a9712e..00000000000 --- a/analyzers/its/expected/Nancy/S1694-Nancy-net452.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy/Bootstrapper/ContainerRegistration.cs#L11", - "Location": "Line 11 Position 27-48" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy/Bootstrapper/Registrations.cs#L12", - "Location": "Line 12 Position 27-40" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy/Diagnostics/DiagnosticModule.cs#L9", - "Location": "Line 9 Position 27-43" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy/NamedPipelineBase.cs#L11", - "Location": "Line 11 Position 27-44" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy/NancyModule.cs#L18", - "Location": "Line 18 Position 27-38" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/Nancy/S1694-Nancy-netstandard2.0.json b/analyzers/its/expected/Nancy/S1694-Nancy-netstandard2.0.json deleted file mode 100644 index 042a7a9712e..00000000000 --- a/analyzers/its/expected/Nancy/S1694-Nancy-netstandard2.0.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy/Bootstrapper/ContainerRegistration.cs#L11", - "Location": "Line 11 Position 27-48" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy/Bootstrapper/Registrations.cs#L12", - "Location": "Line 12 Position 27-40" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy/Diagnostics/DiagnosticModule.cs#L9", - "Location": "Line 9 Position 27-43" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy/NamedPipelineBase.cs#L11", - "Location": "Line 11 Position 27-44" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy/NancyModule.cs#L18", - "Location": "Line 18 Position 27-38" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/Nancy/S1694-Nancy.Hosting.Aspnet-net452.json b/analyzers/its/expected/Nancy/S1694-Nancy.Hosting.Aspnet-net452.json deleted file mode 100644 index f087a06a999..00000000000 --- a/analyzers/its/expected/Nancy/S1694-Nancy.Hosting.Aspnet-net452.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy.Hosting.Aspnet/DefaultNancyAspNetBootstrapper.cs#L16", - "Location": "Line 16 Position 27-57" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/Nancy/S1694-Nancy.Metadata.Modules-net452.json b/analyzers/its/expected/Nancy/S1694-Nancy.Metadata.Modules-net452.json deleted file mode 100644 index 3340c78d6bb..00000000000 --- a/analyzers/its/expected/Nancy/S1694-Nancy.Metadata.Modules-net452.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy.Metadata.Modules/MetadataModule.cs#L11", - "Location": "Line 11 Position 27-41" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/Nancy/S1694-Nancy.Metadata.Modules-netstandard2.0.json b/analyzers/its/expected/Nancy/S1694-Nancy.Metadata.Modules-netstandard2.0.json deleted file mode 100644 index 3340c78d6bb..00000000000 --- a/analyzers/its/expected/Nancy/S1694-Nancy.Metadata.Modules-netstandard2.0.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy.Metadata.Modules/MetadataModule.cs#L11", - "Location": "Line 11 Position 27-41" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/Nancy/S1694-Nancy.ViewEngines.Razor-net452.json b/analyzers/its/expected/Nancy/S1694-Nancy.ViewEngines.Razor-net452.json deleted file mode 100644 index 098b323c2f1..00000000000 --- a/analyzers/its/expected/Nancy/S1694-Nancy.ViewEngines.Razor-net452.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/Nancy/src/Nancy.ViewEngines.Razor/HtmlHelpers.cs#L35", - "Location": "Line 35 Position 27-38" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka-netstandard2.0.json index 1e6cd17e58c..9e1c77b4c7f 100644 --- a/analyzers/its/expected/akka.net/S1694-Akka-netstandard2.0.json +++ b/analyzers/its/expected/akka.net/S1694-Akka-netstandard2.0.json @@ -1,89 +1,5 @@ { "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Actor/ActorBase.cs#L18", - "Location": "Line 18 Position 27-33" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Actor/ActorProducerPipeline.cs#L50", - "Location": "Line 50 Position 27-50" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Actor/ActorProducerPipeline.cs#L81", - "Location": "Line 81 Position 27-50" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Actor/ActorSelection.cs#L388", - "Location": "Line 388 Position 27-47" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Actor/ActorSystem.cs#L25", - "Location": "Line 25 Position 27-44" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Actor/ChildrenContainer/Internal/SuspendReason.cs#L16", - "Location": "Line 16 Position 27-40" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Actor/Exceptions.cs#L16", - "Location": "Line 16 Position 27-40" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Actor/FSM.cs#L202", - "Location": "Line 202 Position 31-37" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Actor/FSM.cs#L668", - "Location": "Line 668 Position 27-30" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Actor/ReceiveActor.cs#L20", - "Location": "Line 20 Position 27-39" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Actor/Setup/ActorSystemSetup.cs#L22", - "Location": "Line 22 Position 27-32" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Actor/Stash/Internal/AbstractStash.cs#L22", - "Location": "Line 22 Position 27-40" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Actor/TypedActor.cs#L30", - "Location": "Line 30 Position 27-37" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Configuration/Hocon/CDataConfigurationElement.cs#L34", - "Location": "Line 34 Position 27-52" - }, { "Id": "S1694", "Message": "Convert this \u0027abstract\u0027 class to an interface.", @@ -96,155 +12,23 @@ "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Dispatch/Mailbox.cs#L554", "Location": "Line 554 Position 27-38" }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Dispatch/SysMsg/ISystemMessage.cs#L282", - "Location": "Line 282 Position 27-40" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Event/DeadLetter.cs#L29", - "Location": "Line 29 Position 27-41" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Dns.cs#L22", - "Location": "Line 22 Position 27-34" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Dns.cs#L62", - "Location": "Line 62 Position 31-38" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Inet.cs#L20", - "Location": "Line 20 Position 31-43" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Inet.cs#L229", - "Location": "Line 229 Position 31-43" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Inet.cs#L53", - "Location": "Line 53 Position 31-51" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Inet.cs#L58", - "Location": "Line 58 Position 31-45" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Inet.cs#L71", - "Location": "Line 71 Position 31-53" - }, { "Id": "S1694", "Message": "Convert this \u0027abstract\u0027 class to an interface.", "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/IO.cs#L15", "Location": "Line 15 Position 27-38" }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Tcp.cs#L392", - "Location": "Line 392 Position 31-43" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Tcp.cs#L56", - "Location": "Line 56 Position 33-48" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Tcp.cs#L95", - "Location": "Line 95 Position 31-38" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Udp.cs#L107", - "Location": "Line 107 Position 31-38" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Udp.cs#L110", - "Location": "Line 110 Position 31-38" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Udp.cs#L348", - "Location": "Line 348 Position 31-36" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/Udp.cs#L37", - "Location": "Line 37 Position 33-48" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/UdpConnected.cs#L100", - "Location": "Line 100 Position 31-38" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/UdpConnected.cs#L295", - "Location": "Line 295 Position 31-36" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/UdpConnected.cs#L37", - "Location": "Line 37 Position 33-48" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/IO/UdpConnected.cs#L95", - "Location": "Line 95 Position 31-38" - }, { "Id": "S1694", "Message": "Convert this \u0027abstract\u0027 class to an interface.", "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Pattern/BackoffOptions.cs#L77", "Location": "Line 77 Position 27-41" }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Routing/Listeners.cs#L37", - "Location": "Line 37 Position 27-42" - }, { "Id": "S1694", "Message": "Convert this \u0027abstract\u0027 class to an interface.", "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Routing/Router.cs#L263", "Location": "Line 263 Position 27-39" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka/Routing/RouterMsg.cs#L31", - "Location": "Line 31 Position 27-50" } ] } \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Cluster-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.Cluster-netstandard2.0.json deleted file mode 100644 index cce27e6ad56..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Cluster-netstandard2.0.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Cluster/ClusterDaemon.cs#L39", - "Location": "Line 39 Position 33-54" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Cluster/ClusterEvent.cs#L235", - "Location": "Line 235 Position 31-49" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Cluster/ClusterEvent.cs#L592", - "Location": "Line 592 Position 31-48" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Cluster/Routing/ClusterRoutingConfig.cs#L209", - "Location": "Line 209 Position 27-52" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Cluster.Metrics-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.Cluster.Metrics-netstandard2.0.json deleted file mode 100644 index a23ce095be7..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Cluster.Metrics-netstandard2.0.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/contrib/cluster/Akka.Cluster.Metrics/Routing/MetricSelectors.cs#L158", - "Location": "Line 158 Position 27-49" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Cluster.Sharding-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.Cluster.Sharding-netstandard2.0.json deleted file mode 100644 index 1f869213ab0..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Cluster.Sharding-netstandard2.0.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/contrib/cluster/Akka.Cluster.Sharding/Shard.cs#L180", - "Location": "Line 180 Position 31-42" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Cluster.TestKit-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.Cluster.TestKit-netstandard2.0.json deleted file mode 100644 index 4943d6eb389..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Cluster.TestKit-netstandard2.0.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Cluster.TestKit/MultiNodeClusterSpec.cs#L30", - "Location": "Line 30 Position 27-47" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.DistributedData-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.DistributedData-netstandard2.0.json deleted file mode 100644 index ad9a55bdaec..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.DistributedData-netstandard2.0.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/contrib/cluster/Akka.DistributedData/Key.cs#L38", - "Location": "Line 38 Position 27-30" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.MultiNodeTestRunner.Shared-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.MultiNodeTestRunner.Shared-netstandard2.0.json deleted file mode 100644 index 159c4e25e75..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.MultiNodeTestRunner.Shared-netstandard2.0.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.MultiNodeTestRunner.Shared/Reporting/MultiNodeMessage.cs#L16", - "Location": "Line 16 Position 27-43" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Persistence.Sql.Common-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.Persistence.Sql.Common-netstandard2.0.json deleted file mode 100644 index bda520edaf0..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Persistence.Sql.Common-netstandard2.0.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/contrib/persistence/Akka.Persistence.Sql.Common/Journal/BatchingSqlJournal.cs#L172", - "Location": "Line 172 Position 27-50" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Persistence.Sql.TestKit-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.Persistence.Sql.TestKit-netstandard2.0.json deleted file mode 100644 index 26e7eefbb3a..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Persistence.Sql.TestKit-netstandard2.0.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/contrib/persistence/Akka.Persistence.Sql.TestKit/SqlJournalConnectionFailureSpec.cs#L17", - "Location": "Line 17 Position 27-58" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/contrib/persistence/Akka.Persistence.Sql.TestKit/SqlJournalConnectionFailureSpec.cs#L53", - "Location": "Line 53 Position 32-58" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/contrib/persistence/Akka.Persistence.Sql.TestKit/SqlSnapshotConnectionFailureSpec.cs#L18", - "Location": "Line 18 Position 27-59" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Persistence.TCK-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.Persistence.TCK-netstandard2.0.json deleted file mode 100644 index 94d7fceab43..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Persistence.TCK-netstandard2.0.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Persistence.TCK/Journal/JournalSpec.cs#L24", - "Location": "Line 24 Position 27-38" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Persistence.TCK/Performance/JournalPerfSpec.cs#L34", - "Location": "Line 34 Position 27-42" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Persistence.TCK/PluginSpec.cs#L17", - "Location": "Line 17 Position 27-37" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Persistence.TCK/Query/CurrentEventsByPersistenceIdSpec.cs#L22", - "Location": "Line 22 Position 27-59" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Persistence.TCK/Query/CurrentEventsByTagSpec.cs#L21", - "Location": "Line 21 Position 27-49" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Persistence.TCK/Query/CurrentPersistenceIdsSpec.cs#L21", - "Location": "Line 21 Position 27-52" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Persistence.TCK/Query/EventsByPersistenceIdSpec.cs#L22", - "Location": "Line 22 Position 27-52" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Persistence.TCK/Query/EventsByTagSpec.cs#L22", - "Location": "Line 22 Position 27-42" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Persistence.TCK/Query/PersistenceIdsSpec.cs#L25", - "Location": "Line 25 Position 27-45" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Persistence.TCK/Serialization/JournalSerializationSpec.cs#L23", - "Location": "Line 23 Position 27-51" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Persistence.TCK/Serialization/SnapshotStoreSerializationSpec.cs#L20", - "Location": "Line 20 Position 27-57" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Persistence.TCK/Snapshot/SnapshotStoreSpec.cs#L26", - "Location": "Line 26 Position 27-44" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Persistence.TestKit.Xunit2-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.Persistence.TestKit.Xunit2-netstandard2.0.json deleted file mode 100644 index 6bdb108d6a8..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Persistence.TestKit.Xunit2-netstandard2.0.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Persistence.TestKit.Xunit2/PersistenceTestKit.cs#L24", - "Location": "Line 24 Position 27-45" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Remote-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.Remote-netstandard2.0.json index 8826b9cecbb..2d30760a9de 100644 --- a/analyzers/its/expected/akka.net/S1694-Akka.Remote-netstandard2.0.json +++ b/analyzers/its/expected/akka.net/S1694-Akka.Remote-netstandard2.0.json @@ -1,76 +1,22 @@ { "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Remote/Endpoint.cs#L931", - "Location": "Line 931 Position 29-42" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Remote/EndpointManager.cs#L115", - "Location": "Line 115 Position 31-46" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Remote/EndpointManager.cs#L35", - "Location": "Line 35 Position 31-45" - }, { "Id": "S1694", "Message": "Convert this \u0027abstract\u0027 class to an interface.", "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Remote/FailureDetector.cs#L17", "Location": "Line 17 Position 27-42" }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Remote/RemoteWatcher.cs#L64", - "Location": "Line 64 Position 31-43" - }, { "Id": "S1694", "Message": "Convert this \u0027abstract\u0027 class to an interface.", "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Remote/RemotingLifecycleEvent.cs#L21", "Location": "Line 21 Position 27-49" }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Remote/Transport/AkkaProtocolTransport.cs#L538", - "Location": "Line 538 Position 29-46" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Remote/Transport/AkkaProtocolTransport.cs#L542", - "Location": "Line 542 Position 29-53" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Remote/Transport/DotNetty/TcpTransport.cs#L23", - "Location": "Line 23 Position 29-40" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Remote/Transport/TestTransport.cs#L297", - "Location": "Line 297 Position 27-35" - }, { "Id": "S1694", "Message": "Convert this \u0027abstract\u0027 class to an interface.", "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Remote/Transport/ThrottleTransportAdapter.cs#L570", "Location": "Line 570 Position 27-39" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Remote/Transport/TransportAdapters.cs#L388", - "Location": "Line 388 Position 29-47" } ] } \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Remote.TestKit-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.Remote.TestKit-netstandard2.0.json deleted file mode 100644 index 895f4e68b6d..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Remote.TestKit-netstandard2.0.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Remote.TestKit/MultiNodeSpec.cs#L32", - "Location": "Line 32 Position 27-42" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Serialization.TestKit-net471.json b/analyzers/its/expected/akka.net/S1694-Akka.Serialization.TestKit-net471.json deleted file mode 100644 index 9f57ec13bd3..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Serialization.TestKit-net471.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/contrib/serializers/Akka.Serialization.TestKit/AkkaSerializationSpec.cs#L41", - "Location": "Line 41 Position 27-48" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Serialization.TestKit-net5.0.json b/analyzers/its/expected/akka.net/S1694-Akka.Serialization.TestKit-net5.0.json deleted file mode 100644 index 9f57ec13bd3..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Serialization.TestKit-net5.0.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/contrib/serializers/Akka.Serialization.TestKit/AkkaSerializationSpec.cs#L41", - "Location": "Line 41 Position 27-48" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Serialization.TestKit-netcoreapp3.1.json b/analyzers/its/expected/akka.net/S1694-Akka.Serialization.TestKit-netcoreapp3.1.json deleted file mode 100644 index 9f57ec13bd3..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Serialization.TestKit-netcoreapp3.1.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/contrib/serializers/Akka.Serialization.TestKit/AkkaSerializationSpec.cs#L41", - "Location": "Line 41 Position 27-48" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Streams-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.Streams-netstandard2.0.json deleted file mode 100644 index b3b98d31fcf..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Streams-netstandard2.0.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/CodeGen/Dsl/UnzipWith.cs#L117", - "Location": "Line 117 Position 27-43" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/CodeGen/Dsl/UnzipWith.cs#L140", - "Location": "Line 140 Position 27-43" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/CodeGen/Dsl/UnzipWith.cs#L35", - "Location": "Line 35 Position 27-43" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/CodeGen/Dsl/UnzipWith.cs#L54", - "Location": "Line 54 Position 27-43" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/CodeGen/Dsl/UnzipWith.cs#L74", - "Location": "Line 74 Position 27-43" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/CodeGen/Dsl/UnzipWith.cs#L95", - "Location": "Line 95 Position 27-43" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/Dsl/UnfoldFlow.cs#L15", - "Location": "Line 15 Position 29-54" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/Graph.cs#L79", - "Location": "Line 79 Position 27-40" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/Implementation/ActorProcessor.cs#L557", - "Location": "Line 557 Position 29-47" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/Implementation/ActorProcessor.cs#L99", - "Location": "Line 99 Position 27-46" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/Implementation/FanIn.cs#L537", - "Location": "Line 537 Position 27-32" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/Implementation/FanOut.cs#L533", - "Location": "Line 533 Position 27-33" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/Implementation/Fusing/Ops.cs#L382", - "Location": "Line 382 Position 27-52" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/Implementation/Fusing/StreamOfStreams.cs#L997", - "Location": "Line 997 Position 33-70" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/Shape.cs#L22", - "Location": "Line 22 Position 27-33" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/Shape.cs#L36", - "Location": "Line 36 Position 27-34" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Streams/Stage/GraphStage.cs#L424", - "Location": "Line 424 Position 27-42" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.TestKit-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.TestKit-netstandard2.0.json index da32e1fc27e..e56f536532d 100644 --- a/analyzers/its/expected/akka.net/S1694-Akka.TestKit-netstandard2.0.json +++ b/analyzers/its/expected/akka.net/S1694-Akka.TestKit-netstandard2.0.json @@ -5,60 +5,6 @@ "Message": "Convert this \u0027abstract\u0027 class to an interface.", "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.TestKit/MessageEnvelope.cs#L15", "Location": "Line 15 Position 27-42" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.TestKit/TestActorRefBase.cs#L22", - "Location": "Line 22 Position 27-43" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.TestKit/TestKitBase_ActorOf.cs#L18", - "Location": "Line 18 Position 26-37" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.TestKit/TestKitBase_AwaitAssert.cs#L18", - "Location": "Line 18 Position 35-46" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.TestKit/TestKitBase_AwaitConditions.cs#L19", - "Location": "Line 19 Position 35-46" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.TestKit/TestKitBase_Expect.cs#L21", - "Location": "Line 21 Position 35-46" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.TestKit/TestKitBase_ExpectMsgFrom.cs#L16", - "Location": "Line 16 Position 35-46" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.TestKit/TestKitBase_Receive.cs#L19", - "Location": "Line 19 Position 35-46" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.TestKit/TestKitBase_Within.cs#L18", - "Location": "Line 18 Position 35-46" - }, - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.TestKit/TestKitBase.cs#L26", - "Location": "Line 26 Position 35-46" } ] } \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Tests.Performance-netcoreapp3.1.json b/analyzers/its/expected/akka.net/S1694-Akka.Tests.Performance-netcoreapp3.1.json deleted file mode 100644 index 960845d7e7d..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Tests.Performance-netcoreapp3.1.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Tests.Performance/Actor/ActorSystemShutdownSpec.cs#L17", - "Location": "Line 17 Position 27-50" - } - ] -} \ No newline at end of file diff --git a/analyzers/its/expected/akka.net/S1694-Akka.Tests.Shared.Internals-netstandard2.0.json b/analyzers/its/expected/akka.net/S1694-Akka.Tests.Shared.Internals-netstandard2.0.json deleted file mode 100644 index 6c38a1ad62b..00000000000 --- a/analyzers/its/expected/akka.net/S1694-Akka.Tests.Shared.Internals-netstandard2.0.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Issues": [ - { - "Id": "S1694", - "Message": "Convert this \u0027abstract\u0027 class to a concrete type with a protected constructor.", - "Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/akka.net/src/core/Akka.Tests.Shared.Internals/AkkaSpec.cs#L29", - "Location": "Line 29 Position 27-35" - } - ] -} \ No newline at end of file diff --git a/analyzers/rspec/cs/S1694.html b/analyzers/rspec/cs/S1694.html index 3ca4e7cecf4..544f8565a6a 100644 --- a/analyzers/rspec/cs/S1694.html +++ b/analyzers/rspec/cs/S1694.html @@ -1,27 +1,13 @@
The purpose of an abstract class is to provide some heritable behaviors while also defining methods which must be implemented by sub-classes.
-A class
with no abstract methods that was made abstract
purely to prevent instantiation should be converted to a concrete
-class
(i.e. remove the abstract
keyword) with a protected
constructor.
A class
with only abstract
methods and no inheritable behavior should be converted to an interface
.
-public abstract class Animal //Noncompliant; should be an interface +public abstract class Animal // Noncompliant; should be an interface { abstract void Move(); abstract void Feed(); } - -public abstract class Color //Noncompliant; should be concrete with a protected constructor -{ - private int red = 0; - private int green = 0; - private int blue = 0; - - public int GetRed() - { - return red; - } -}
@@ -31,21 +17,6 @@Compliant solution
void Feed(); } -public class Color -{ - private int red = 0; - private int green = 0; - private int blue = 0; - - protected Color() - {} - - public int GetRed() - { - return red; - } -} - public abstract class Lamp { private bool switchLamp = false; diff --git a/analyzers/rspec/cs/Sonar_way_profile.json b/analyzers/rspec/cs/Sonar_way_profile.json index 5184a965820..3450e95492b 100644 --- a/analyzers/rspec/cs/Sonar_way_profile.json +++ b/analyzers/rspec/cs/Sonar_way_profile.json @@ -47,6 +47,7 @@ "S1607", "S1643", "S1656", + "S1694", "S1696", "S1699", "S1751", diff --git a/analyzers/src/SonarAnalyzer.CSharp/Rules/AbstractClassToInterface.cs b/analyzers/src/SonarAnalyzer.CSharp/Rules/AbstractClassToInterface.cs new file mode 100644 index 00000000000..6b4ce9d8a56 --- /dev/null +++ b/analyzers/src/SonarAnalyzer.CSharp/Rules/AbstractClassToInterface.cs @@ -0,0 +1,78 @@ +/* + * SonarAnalyzer for .NET + * Copyright (C) 2015-2024 SonarSource SA + * mailto: contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +namespace SonarAnalyzer.Rules.CSharp; + +[DiagnosticAnalyzer(LanguageNames.CSharp)] +public sealed class AbstractClassToInterface : SonarDiagnosticAnalyzer+{ + private const string DiagnosticId = "S1694"; + + private static readonly MethodKind[] ConstructorKinds = [MethodKind.Constructor, MethodKind.SharedConstructor]; + + protected override string MessageFormat => "Convert this 'abstract' {0} to an interface."; + protected override ILanguageFacade Language => CSharpFacade.Instance; + + public AbstractClassToInterface() : base(DiagnosticId) { } + + protected override void Initialize(SonarAnalysisContext context) => + context.RegisterSymbolAction( + c => + { + var symbol = (INamedTypeSymbol)c.Symbol; + if (symbol.IsClass() + && symbol.IsAbstract + && symbol.BaseType.Is(KnownType.System_Object) + && !IsRecordWithParameters(symbol) + && AllMethodsAreAbstract(symbol)) + { + foreach (var declaringSyntaxReference in symbol.DeclaringSyntaxReferences) + { + var node = declaringSyntaxReference.GetSyntax(); + if (node is ClassDeclarationSyntax classDeclaration) + { + c.ReportIssue(Rule, classDeclaration.Identifier, "class"); + } + + if (RecordDeclarationSyntaxWrapper.IsInstance(node)) + { + var wrapper = (RecordDeclarationSyntaxWrapper)node; + c.ReportIssue(Rule, wrapper.Identifier, "record"); + } + } + } + }, + SymbolKind.NamedType); + + private static bool IsRecordWithParameters(ISymbol symbol) => + symbol.DeclaringSyntaxReferences.Any(x => x.GetSyntax() is { } node + && RecordDeclarationSyntaxWrapper.IsInstance(node) + && ((RecordDeclarationSyntaxWrapper)node).ParameterList is { } parameterList + && parameterList.Parameters.Count > 0); + + private static bool AllMethodsAreAbstract(INamedTypeSymbol symbol) + { + var methods = GetAllMethods(symbol); + return methods.Any() && methods.All(x => x.IsAbstract); + } + + private static IMethodSymbol[] GetAllMethods(INamedTypeSymbol symbol) => + symbol.GetMembers().OfType ().Where(x => !x.IsImplicitlyDeclared && !ConstructorKinds.Contains(x.MethodKind)).ToArray(); +} diff --git a/analyzers/src/SonarAnalyzer.CSharp/Rules/ClassShouldNotBeAbstract.cs b/analyzers/src/SonarAnalyzer.CSharp/Rules/ClassShouldNotBeAbstract.cs deleted file mode 100644 index 377a79fa0ad..00000000000 --- a/analyzers/src/SonarAnalyzer.CSharp/Rules/ClassShouldNotBeAbstract.cs +++ /dev/null @@ -1,130 +0,0 @@ -/* - * SonarAnalyzer for .NET - * Copyright (C) 2015-2024 SonarSource SA - * mailto: contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -namespace SonarAnalyzer.Rules.CSharp -{ - [DiagnosticAnalyzer(LanguageNames.CSharp)] - public sealed class ClassShouldNotBeAbstract : SonarDiagnosticAnalyzer - { - private const string DiagnosticId = "S1694"; - private const string MessageFormat = "Convert this 'abstract' {0} to {1}."; - private const string MessageToInterface = "an interface"; - private const string MessageToConcreteImplementation = "a concrete type with a protected constructor"; - - private static readonly DiagnosticDescriptor Rule = - DescriptorFactory.Create(DiagnosticId, MessageFormat); - - public override ImmutableArray SupportedDiagnostics { get; } = ImmutableArray.Create(Rule); - - protected override void Initialize(SonarAnalysisContext context) => - context.RegisterSymbolAction( - c => - { - var symbol = (INamedTypeSymbol)c.Symbol; - if (!symbol.IsClass() - || !symbol.IsAbstract - || HasInheritedAbstractMembers(symbol)) - { - return; - } - - if (!IsRecordWithParameters(symbol) && AbstractTypeShouldBeInterface(symbol)) - { - Report(c, symbol, MessageToInterface); - return; - } - - if (AbstractTypeShouldBeConcrete(symbol)) - { - Report(c, symbol, MessageToConcreteImplementation); - } - }, - SymbolKind.NamedType); - - private static bool HasInheritedAbstractMembers(INamedTypeSymbol symbol) - { - var baseTypes = symbol.BaseType.GetSelfAndBaseTypes().ToList(); - var abstractMethods = baseTypes.SelectMany(GetAllAbstractMethods); - var baseTypesAndSelf = baseTypes.Concat(new[] { symbol }).ToList(); - var overrideMethods = baseTypesAndSelf.SelectMany(GetAllOverrideMethods); - var overriddenMethods = overrideMethods.Select(m => m.OverriddenMethod); - var stillAbstractMethods = abstractMethods.Except(overriddenMethods); - - return stillAbstractMethods.Any(); - } - - private static IEnumerable GetAllAbstractMethods(INamedTypeSymbol symbol) => - GetAllMethods(symbol).Where(m => m.IsAbstract); - - private static IEnumerable GetAllOverrideMethods(INamedTypeSymbol symbol) => - GetAllMethods(symbol).Where(m => m.IsOverride); - - private static void Report(SonarSymbolReportingContext context, INamedTypeSymbol symbol, string message) - { - foreach (var declaringSyntaxReference in symbol.DeclaringSyntaxReferences) - { - var node = declaringSyntaxReference.GetSyntax(); - if (node is ClassDeclarationSyntax classDeclaration) - { - context.ReportIssue(Rule, classDeclaration.Identifier.GetLocation(), "class", message); - } - - if (RecordDeclarationSyntaxWrapper.IsInstance(node)) - { - var wrapper = (RecordDeclarationSyntaxWrapper)node; - context.ReportIssue(Rule, wrapper.Identifier, "record", message); - } - } - } - - private static bool IsRecordWithParameters(ISymbol symbol) => - symbol.DeclaringSyntaxReferences.Any(reference => reference.GetSyntax() is { } node - && RecordDeclarationSyntaxWrapper.IsInstance(node) - && ((RecordDeclarationSyntaxWrapper)node).ParameterList is { } parameterList - && parameterList.Parameters.Count > 0); - - private static bool AbstractTypeShouldBeInterface(INamedTypeSymbol symbol) - { - var methods = GetAllMethods(symbol); - return symbol.BaseType.Is(KnownType.System_Object) - && methods.Any() - && methods.All(method => method.IsAbstract); - } - - private static bool AbstractTypeShouldBeConcrete(INamedTypeSymbol symbol) - { - var methods = GetAllMethods(symbol); - return !methods.Any() - || methods.All(method => !method.IsAbstract); - } - - private static IList GetAllMethods(INamedTypeSymbol symbol) => - symbol.GetMembers() - .OfType () - .Where(method => !method.IsImplicitlyDeclared && !ConstructorKinds.Contains(method.MethodKind)) - .ToList(); - - private static readonly ISet ConstructorKinds = new HashSet - { - MethodKind.Constructor, - MethodKind.SharedConstructor - }; - } -} diff --git a/analyzers/tests/SonarAnalyzer.Test/AnalysisContext/SonarAnalysisContextTest.cs b/analyzers/tests/SonarAnalyzer.Test/AnalysisContext/SonarAnalysisContextTest.cs index 3327c327942..1aedb933c5f 100644 --- a/analyzers/tests/SonarAnalyzer.Test/AnalysisContext/SonarAnalysisContextTest.cs +++ b/analyzers/tests/SonarAnalyzer.Test/AnalysisContext/SonarAnalysisContextTest.cs @@ -29,13 +29,10 @@ namespace SonarAnalyzer.Test.AnalysisContext; [TestClass] public partial class SonarAnalysisContextTest { - public TestContext TestContext { get; set; } - // Various classes that invoke all the `ReportIssue` methods in AnalysisContextExtensions // We mention in comments the type of Context that is used to invoke (directly or indirectly) the `ReportIssue` method - private readonly List testCases = new( - new[] - { + private readonly List testCases = + [ // SyntaxNodeAnalysisContext // S3244 - MAIN and TEST new TestSetup("AnonymousDelegateEventUnsubscribe.cs", new AnonymousDelegateEventUnsubscribe()), @@ -65,8 +62,10 @@ public partial class SonarAnalysisContextTest // S2953 - MAIN only new TestSetup("DisposeNotImplementingDispose.cs", new DisposeNotImplementingDispose()), // S1694 - MAIN only - new TestSetup("ClassShouldNotBeAbstract.cs", new ClassShouldNotBeAbstract()), - }); + new TestSetup("AbstractClassToInterface.cs", new AbstractClassToInterface()), + ]; + + public TestContext TestContext { get; set; } [TestMethod] public void Constructor_Null() => diff --git a/analyzers/tests/SonarAnalyzer.Test/Rules/ClassShouldNotBeAbstractTest.cs b/analyzers/tests/SonarAnalyzer.Test/Rules/AbstractClassToInterfaceTest.cs similarity index 52% rename from analyzers/tests/SonarAnalyzer.Test/Rules/ClassShouldNotBeAbstractTest.cs rename to analyzers/tests/SonarAnalyzer.Test/Rules/AbstractClassToInterfaceTest.cs index 339bd4b944d..2f4851ef871 100644 --- a/analyzers/tests/SonarAnalyzer.Test/Rules/ClassShouldNotBeAbstractTest.cs +++ b/analyzers/tests/SonarAnalyzer.Test/Rules/AbstractClassToInterfaceTest.cs @@ -20,32 +20,31 @@ using SonarAnalyzer.Rules.CSharp; -namespace SonarAnalyzer.Test.Rules +namespace SonarAnalyzer.Test.Rules; + +[TestClass] +public class AbstractClassToInterfaceTest { - [TestClass] - public class ClassShouldNotBeAbstractTest - { - private readonly VerifierBuilder builder = new VerifierBuilder (); + private readonly VerifierBuilder builder = new VerifierBuilder (); - [TestMethod] - public void ClassShouldNotBeAbstract() => - builder.AddPaths("ClassShouldNotBeAbstract.cs").Verify(); + [TestMethod] + public void ClassShouldNotBeAbstract() => + builder.AddPaths("AbstractClassToInterface.cs").Verify(); #if NET - [TestMethod] - public void ClassShouldNotBeAbstract_CSharp9() => - builder.AddPaths("ClassShouldNotBeAbstract.CSharp9.cs") - .WithOptions(ParseOptionsHelper.FromCSharp9) - .Verify(); + [TestMethod] + public void ClassShouldNotBeAbstract_CSharp9() => + builder.AddPaths("AbstractClassToInterface.CSharp9.cs") + .WithOptions(ParseOptionsHelper.FromCSharp9) + .Verify(); - [TestMethod] - public void ClassShouldNotBeAbstract_CSharp11() => - builder.AddPaths("ClassShouldNotBeAbstract.CSharp11.cs") - .WithOptions(ParseOptionsHelper.FromCSharp11) - .Verify(); + [TestMethod] + public void ClassShouldNotBeAbstract_CSharp11() => + builder.AddPaths("AbstractClassToInterface.CSharp11.cs") + .WithOptions(ParseOptionsHelper.FromCSharp11) + .Verify(); #endif - } } diff --git a/analyzers/tests/SonarAnalyzer.Test/TestCases/AbstractClassToInterface.CSharp11.cs b/analyzers/tests/SonarAnalyzer.Test/TestCases/AbstractClassToInterface.CSharp11.cs new file mode 100644 index 00000000000..64aacfcfd9c --- /dev/null +++ b/analyzers/tests/SonarAnalyzer.Test/TestCases/AbstractClassToInterface.CSharp11.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; + +file abstract class Empty +{ +} + +file abstract class OnlyAbstract // Noncompliant {{Convert this 'abstract' class to an interface.}} +// ^^^^^^^^^^^^ +{ + protected abstract void Move(); +} + +file abstract class Animal2 //Compliant +{ + protected abstract void Move(); + string Foo() => "FOO"; +} diff --git a/analyzers/tests/SonarAnalyzer.Test/TestCases/AbstractClassToInterface.CSharp9.cs b/analyzers/tests/SonarAnalyzer.Test/TestCases/AbstractClassToInterface.CSharp9.cs new file mode 100644 index 00000000000..4bd43dfa4df --- /dev/null +++ b/analyzers/tests/SonarAnalyzer.Test/TestCases/AbstractClassToInterface.CSharp9.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; + +public abstract record Empty { } + +public abstract record Animal // Noncompliant {{Convert this 'abstract' record to an interface.}} +{ + protected abstract void move(); + protected abstract void feed(); +} + +public record SomeBaseRecord { } + +public abstract record Animal2 : SomeBaseRecord // Compliant +{ + protected abstract void move(); + protected abstract void feed(); +} + +public abstract record Color +{ + private int red = 0; + public int getRed() => red; +} + +public interface AnimalCompliant +{ + void move(); + void feed(); +} + +public class ColorCompliant +{ + private int red = 0; + + private ColorCompliant() + { } + + public int getRed() => red; +} + +public abstract record LampCompliant +{ + + private bool switchLamp = false; + + public abstract void glow(); + + public void flipSwitch() + { + switchLamp = !switchLamp; + if (switchLamp) + { + glow(); + } + } +} + +public abstract record View // Noncompliant {{Convert this 'abstract' record to an interface.}} +// ^^^^ +{ + public abstract string Content { get; } +} + +public abstract record View2() // Compliant, has abstract and non abstract members +{ + public abstract string Content { get; } + public abstract string Content1 { get; } + public string Content2 { get; } +} + +public abstract record Record(string X); + +public abstract record Record2(string X) // Compliant, this record has a propery X which is concrete +{ + public abstract string Content { get; } +} diff --git a/analyzers/tests/SonarAnalyzer.Test/TestCases/AbstractClassToInterface.cs b/analyzers/tests/SonarAnalyzer.Test/TestCases/AbstractClassToInterface.cs new file mode 100644 index 00000000000..af46ffc7251 --- /dev/null +++ b/analyzers/tests/SonarAnalyzer.Test/TestCases/AbstractClassToInterface.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; + +public abstract partial class PartialMixed +{ + public abstract void X(); +} +public abstract partial class PartialMixed +{ + public void Y() { } +} + +public abstract partial class PartialAbstract // Noncompliant +{ + public abstract void X(); +} +public abstract partial class PartialAbstract // Noncompliant +{ + public abstract void Y(); +} + +public abstract class Empty +{ +} + +public abstract class Animal // Noncompliant {{Convert this 'abstract' class to an interface.}} +// ^^^^^^ +{ + protected abstract void move(); + protected abstract void feed(); +} + +public class SomeBaseClass { } + +public abstract class Animal2 : SomeBaseClass //Compliant +{ + protected abstract void move(); + protected abstract void feed(); + +} + +public abstract class Color +{ + private int red = 0; + private int green = 0; + private int blue = 0; + + public int getRed() + { + return red; + } +} + +public interface AnimalCompliant +{ + + void move(); + void feed(); + +} + +public class ColorCompliant +{ + private int red = 0; + private int green = 0; + private int blue = 0; + + private ColorCompliant() + { } + + public int getRed() + { + return red; + } +} + +public abstract class LampCompliant +{ + private bool switchLamp = false; + + public abstract void glow(); + + public void flipSwitch() + { + switchLamp = !switchLamp; + if (switchLamp) + { + glow(); + } + } +} + +public abstract class View // Noncompliant, should be an interface +{ + public abstract string Content { get; } +} + +public abstract class View2 // Compliant, has abstract and non abstract members +{ + public abstract string Content { get; } + public abstract string Content1 { get; } + public string Content2 { get; } +} + +public abstract class View2Derived : View2 // Compliant, still has abstract parts +{ + public string Content3 { get; } + public override string Content1 { get { return ""; } } +} + +public abstract class View3Derived : SomeUnknownType // Error [CS0246] +{ + public string Content3 { get; } + public override int Content1 { get { return 1; } } +} + +public abstract class WithConstructor // Noncompliant +{ + public abstract void ToOverride(); + + static WithConstructor() + { + // Do something here + } + + public WithConstructor() + { + // Do something here + } +} diff --git a/analyzers/tests/SonarAnalyzer.Test/TestCases/ClassShouldNotBeAbstract.CSharp11.cs b/analyzers/tests/SonarAnalyzer.Test/TestCases/ClassShouldNotBeAbstract.CSharp11.cs deleted file mode 100644 index 6d6f5b36eb6..00000000000 --- a/analyzers/tests/SonarAnalyzer.Test/TestCases/ClassShouldNotBeAbstract.CSharp11.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Tests.Diagnostics -{ - file abstract class Empty // Noncompliant {{Convert this 'abstract' class to a concrete type with a protected constructor.}} -// ^^^^^ - { - - } - - file abstract class Animal2 //Compliant - { - protected abstract void Move(); - string Foo() => "FOO"; - } -} diff --git a/analyzers/tests/SonarAnalyzer.Test/TestCases/ClassShouldNotBeAbstract.CSharp9.cs b/analyzers/tests/SonarAnalyzer.Test/TestCases/ClassShouldNotBeAbstract.CSharp9.cs deleted file mode 100644 index ff67f306411..00000000000 --- a/analyzers/tests/SonarAnalyzer.Test/TestCases/ClassShouldNotBeAbstract.CSharp9.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Tests.Diagnostics -{ - public abstract record Empty { } // Noncompliant {{Convert this 'abstract' record to a concrete type with a protected constructor.}} - - public abstract record Animal // Noncompliant {{Convert this 'abstract' record to an interface.}} - { - protected abstract void move(); - protected abstract void feed(); - } - - public record SomeBaseRecord { } - - public abstract record Animal2 : SomeBaseRecord // Compliant - { - protected abstract void move(); - protected abstract void feed(); - } - - public abstract record Color // Noncompliant {{Convert this 'abstract' record to a concrete type with a protected constructor.}} - { - private int red = 0; - public int getRed() => red; - } - - public interface AnimalCompliant - { - void move(); - void feed(); - } - - public class ColorCompliant - { - private int red = 0; - - private ColorCompliant() - { } - - public int getRed() => red; - } - - public abstract record LampCompliant - { - - private bool switchLamp = false; - - public abstract void glow(); - - public void flipSwitch() - { - switchLamp = !switchLamp; - if (switchLamp) - { - glow(); - } - } - } - - public abstract record View // Noncompliant {{Convert this 'abstract' record to an interface.}} - { - public abstract string Content { get; } - } - - public abstract record View2() // Compliant, has abstract and non abstract members - { - public abstract string Content { get; } - public abstract string Content1 { get; } - public string Content2 { get; } - } - - public abstract record Record(string X); // Noncompliant {{Convert this 'abstract' record to a concrete type with a protected constructor.}} - - public abstract record Record2(string X) // Compliant, this record has a propery X which is concrete - { - public abstract string Content { get; } - } -} diff --git a/analyzers/tests/SonarAnalyzer.Test/TestCases/ClassShouldNotBeAbstract.cs b/analyzers/tests/SonarAnalyzer.Test/TestCases/ClassShouldNotBeAbstract.cs deleted file mode 100644 index 0431a03f6b6..00000000000 --- a/analyzers/tests/SonarAnalyzer.Test/TestCases/ClassShouldNotBeAbstract.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Tests.Diagnostics -{ - public abstract partial class A - { - public abstract void X(); - } - public abstract partial class A - { - public void Y() { } - } - - public abstract class Empty // Noncompliant {{Convert this 'abstract' class to a concrete type with a protected constructor.}} -// ^^^^^ - { - - } - - public abstract class Animal //Noncompliant {{Convert this 'abstract' class to an interface.}} - { - protected abstract void move(); - protected abstract void feed(); - - } - - public class SomeBaseClass { } - - public abstract class Animal2 : SomeBaseClass //Compliant - { - protected abstract void move(); - protected abstract void feed(); - - } - - public abstract class Color //Noncompliant {{Convert this 'abstract' class to a concrete type with a protected constructor.}} - { - private int red = 0; - private int green = 0; - private int blue = 0; - - public int getRed() - { - return red; - } - } - - public interface AnimalCompliant - { - - void move(); - void feed(); - - } - - public class ColorCompliant - { - private int red = 0; - private int green = 0; - private int blue = 0; - - private ColorCompliant() - { } - - public int getRed() - { - return red; - } - } - - public abstract class LampCompliant - { - - private bool switchLamp = false; - - public abstract void glow(); - - public void flipSwitch() - { - switchLamp = !switchLamp; - if (switchLamp) - { - glow(); - } - } - } - - public abstract class View // Noncompliant, should be an interface - { - public abstract string Content { get; } - } - - public abstract class View2 // Compliant, has abstract and non abstract members - { - public abstract string Content { get; } - public abstract string Content1 { get; } - public string Content2 { get; } - } - - public abstract class View2Derived : View2 // Compliant, still has abstract parts - { - public string Content3 { get; } - public override string Content1 { get { return ""; } } - } - - public abstract class View3Derived : SomeUnknownType // Noncompliant - // Error@-1 [CS0246] - { - public string Content3 { get; } - public override int Content1 { get { return 1; } } - } -}