move RequiresSuper analyzer into apple subdir, add doc for RequiresSuper analyzer

This commit is contained in:
Whitney Schmidt 2020-02-07 16:41:20 -05:00 коммит произвёл Daniel Cazzulino
Родитель a47767a6ff
Коммит 7a0e316f2e
2 изменённых файлов: 28 добавлений и 1 удалений

24
XIA1004.md Normal file
Просмотреть файл

@ -0,0 +1,24 @@
# XIA1004
## Cause
Overriding a method that requires a call to the overridden method
## Rule description
Notifies you when overriding a method with the `[RequiresSuper]` attribute
## How to fix violations
Apply the provided code fix to add base method call to overriding methods with the [RequiresSuper] attribute
## How to suppress violations
```csharp
[System.Diagnostics.CodeAnalysis.SuppressMessage("Notifications", "XI0004RequiresSuperAttribute:Add base method call to methods with the [RequiresSuper] attribute", Justification = "<Pending>")]
```
```csharp
#pragma warning disable XI0004RequiresSuperAttribute // Add base method call to methods with the [RequiresSuper] attribute
#pragma warning restore XI0004RequiresSuperAttribute // Add base method call to methods with the [RequiresSuper] attribute
```

Просмотреть файл

@ -32,6 +32,8 @@ namespace Xamarin.CodeAnalysis
public class XIA1004RequiresSuper : DiagnosticAnalyzer
{
public static readonly string DiagnosticId = "XI0004RequiresSuperAttribute";
const string HelpLink = "https://github.com/xamarin/CodeAnalysis/blob/master/docs/XIA1004.md";
static readonly DiagnosticDescriptor Rule =
new DiagnosticDescriptor(
@ -40,7 +42,8 @@ namespace Xamarin.CodeAnalysis
"Overriding the {0} method requires a call to the overridden method",
"Notifications",
DiagnosticSeverity.Info,
isEnabledByDefault: true
isEnabledByDefault: true,
HelpLink
);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Rule);