From e10c56f5a13ed27c93692bd279d246e54f7bc2e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rald=20Barr=C3=A9?= Date: Fri, 21 Jul 2023 16:52:43 -0400 Subject: [PATCH] Deprecate MA0018 in favor of CA1000 (#571) --- README.md | 2 +- docs/README.md | 8 ++++---- docs/Rules/MA0018.md | 2 +- .../Rules/DoNotDeclareStaticMembersOnGenericTypes.cs | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3ae1860cb..3dea44e63 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ If you are already using other analyzers, you can check [which rules are duplica |[MA0015](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0015.md)|Usage|Specify the parameter name in ArgumentException|⚠️|✔️|❌| |[MA0016](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0016.md)|Design|Prefer using collection abstraction instead of implementation|⚠️|✔️|❌| |[MA0017](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0017.md)|Design|Abstract types should not have public or internal constructors|⚠️|✔️|✔️| -|[MA0018](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0018.md)|Design|Do not declare static members on generic types|⚠️|✔️|❌| +|[MA0018](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0018.md)|Design|Do not declare static members on generic types (deprecated; use CA1000 instead)|ℹ️|✔️|❌| |[MA0019](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0019.md)|Usage|Use EventArgs.Empty|⚠️|✔️|✔️| |[MA0020](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0020.md)|Performance|Use direct methods instead of LINQ methods|ℹ️|✔️|✔️| |[MA0021](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0021.md)|Usage|Use StringComparer.GetHashCode instead of string.GetHashCode|⚠️|✔️|✔️| diff --git a/docs/README.md b/docs/README.md index d9a26a661..fa3d56f58 100644 --- a/docs/README.md +++ b/docs/README.md @@ -18,7 +18,7 @@ |[MA0015](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0015.md)|Usage|Specify the parameter name in ArgumentException|⚠️|✔️|❌| |[MA0016](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0016.md)|Design|Prefer using collection abstraction instead of implementation|⚠️|✔️|❌| |[MA0017](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0017.md)|Design|Abstract types should not have public or internal constructors|⚠️|✔️|✔️| -|[MA0018](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0018.md)|Design|Do not declare static members on generic types|⚠️|✔️|❌| +|[MA0018](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0018.md)|Design|Do not declare static members on generic types (deprecated; use CA1000 instead)|ℹ️|✔️|❌| |[MA0019](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0019.md)|Usage|Use EventArgs.Empty|⚠️|✔️|✔️| |[MA0020](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0020.md)|Performance|Use direct methods instead of LINQ methods|ℹ️|✔️|✔️| |[MA0021](https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0021.md)|Usage|Use StringComparer.GetHashCode instead of string.GetHashCode|⚠️|✔️|✔️| @@ -195,8 +195,8 @@ dotnet_diagnostic.MA0016.severity = warning # MA0017: Abstract types should not have public or internal constructors dotnet_diagnostic.MA0017.severity = warning -# MA0018: Do not declare static members on generic types -dotnet_diagnostic.MA0018.severity = warning +# MA0018: Do not declare static members on generic types (deprecated; use CA1000 instead) +dotnet_diagnostic.MA0018.severity = suggestion # MA0019: Use EventArgs.Empty dotnet_diagnostic.MA0019.severity = warning @@ -598,7 +598,7 @@ dotnet_diagnostic.MA0016.severity = none # MA0017: Abstract types should not have public or internal constructors dotnet_diagnostic.MA0017.severity = none -# MA0018: Do not declare static members on generic types +# MA0018: Do not declare static members on generic types (deprecated; use CA1000 instead) dotnet_diagnostic.MA0018.severity = none # MA0019: Use EventArgs.Empty diff --git a/docs/Rules/MA0018.md b/docs/Rules/MA0018.md index 62bfaf2f3..40ddfe036 100644 --- a/docs/Rules/MA0018.md +++ b/docs/Rules/MA0018.md @@ -1,4 +1,4 @@ -# MA0018 - Do not declare static members on generic types +# MA0018 - Do not declare static members on generic types (deprecated; use CA1000 instead) When a static member of a generic type is called, the type argument must be specified for the type. When a generic instance member that does not support inference is called, the type argument must be specified for the member. diff --git a/src/Meziantou.Analyzer/Rules/DoNotDeclareStaticMembersOnGenericTypes.cs b/src/Meziantou.Analyzer/Rules/DoNotDeclareStaticMembersOnGenericTypes.cs index 39e0d4bbb..87278a51e 100644 --- a/src/Meziantou.Analyzer/Rules/DoNotDeclareStaticMembersOnGenericTypes.cs +++ b/src/Meziantou.Analyzer/Rules/DoNotDeclareStaticMembersOnGenericTypes.cs @@ -9,10 +9,10 @@ public sealed class DoNotDeclareStaticMembersOnGenericTypes : DiagnosticAnalyzer { private static readonly DiagnosticDescriptor s_rule = new( RuleIdentifiers.DoNotDeclareStaticMembersOnGenericTypes, - title: "Do not declare static members on generic types", - messageFormat: "Do not declare static members on generic types", + title: "Do not declare static members on generic types (deprecated; use CA1000 instead)", + messageFormat: "Do not declare static members on generic types (deprecated; use CA1000 instead)", RuleCategories.Design, - DiagnosticSeverity.Warning, + DiagnosticSeverity.Info, isEnabledByDefault: true, description: "", helpLinkUri: RuleIdentifiers.GetHelpUri(RuleIdentifiers.DoNotDeclareStaticMembersOnGenericTypes));