Skip to content

Commit

Permalink
Fix warnings for analyzer release (#227)
Browse files Browse the repository at this point in the history
* Fix some warnings about analyzer authoring
  • Loading branch information
AaronRobinsonMSFT authored Oct 14, 2020
1 parent be3f4e8 commit c89fc41
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
20 changes: 20 additions & 0 deletions DllImportGenerator/DllImportGenerator/AnalyzerReleases.Shipped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Release 1.0

### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
DLLIMPORTGEN001 | Usage | Error
DLLIMPORTGEN002 | Usage | Error
DLLIMPORTGENANALYZER001 | Usage | Error
DLLIMPORTGENANALYZER002 | Usage | Error
DLLIMPORTGENANALYZER003 | Usage | Error
DLLIMPORTGENANALYZER004 | Usage | Error
DLLIMPORTGENANALYZER005 | Usage | Error
DLLIMPORTGENANALYZER006 | Usage | Error
DLLIMPORTGENANALYZER007 | Usage | Error
DLLIMPORTGENANALYZER008 | Usage | Error
DLLIMPORTGENANALYZER009 | Usage | Error
DLLIMPORTGENANALYZER010 | Usage | Warning
DLLIMPORTGENANALYZER011 | Usage | Warning
DLLIMPORTGENANALYZER012 | Usage | Error
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class Ids
public const string ConfigurationNotSupported = Prefix + "002";
}

private const string Category = "DllImportGenerator";
private const string Category = "SourceGeneration";

public readonly static DiagnosticDescriptor ParameterTypeNotSupported =
new DiagnosticDescriptor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ namespace Microsoft.Interop
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class ManualTypeMarshallingAnalyzer : DiagnosticAnalyzer
{
public const string Prefix = "DLLIMPORTGENANALYZER";
private const string Category = "Usage";
public readonly static DiagnosticDescriptor BlittableTypeMustBeBlittableRule =
new DiagnosticDescriptor(
"INTEROPGEN001",
Prefix + "001",
"BlittableTypeMustBeBlittable",
new LocalizableResourceString(nameof(Resources.BlittableTypeMustBeBlittableMessage), Resources.ResourceManager, typeof(Resources)),
Category,
Expand All @@ -25,7 +26,7 @@ public class ManualTypeMarshallingAnalyzer : DiagnosticAnalyzer

public readonly static DiagnosticDescriptor CannotHaveMultipleMarshallingAttributesRule =
new DiagnosticDescriptor(
"INTEROPGEN002",
Prefix + "002",
"CannotHaveMultipleMarshallingAttributes",
new LocalizableResourceString(nameof(Resources.CannotHaveMultipleMarshallingAttributesMessage), Resources.ResourceManager, typeof(Resources)),
Category,
Expand All @@ -36,7 +37,7 @@ public class ManualTypeMarshallingAnalyzer : DiagnosticAnalyzer

public readonly static DiagnosticDescriptor NativeTypeMustBeNonNullRule =
new DiagnosticDescriptor(
"INTEROPGEN003",
Prefix + "003",
"NativeTypeMustBeNonNull",
new LocalizableResourceString(nameof(Resources.NativeTypeMustBeNonNullMessage), Resources.ResourceManager, typeof(Resources)),
Category,
Expand All @@ -46,7 +47,7 @@ public class ManualTypeMarshallingAnalyzer : DiagnosticAnalyzer

public readonly static DiagnosticDescriptor NativeTypeMustBeBlittableRule =
new DiagnosticDescriptor(
"INTEROPGEN004",
Prefix + "004",
"NativeTypeMustBeBlittable",
new LocalizableResourceString(nameof(Resources.NativeTypeMustBeBlittableMessage), Resources.ResourceManager, typeof(Resources)),
Category,
Expand All @@ -56,7 +57,7 @@ public class ManualTypeMarshallingAnalyzer : DiagnosticAnalyzer

public readonly static DiagnosticDescriptor GetPinnableReferenceReturnTypeBlittableRule =
new DiagnosticDescriptor(
"INTEROPGEN005",
Prefix + "005",
"GetPinnableReferenceReturnTypeBlittable",
new LocalizableResourceString(nameof(Resources.GetPinnableReferenceReturnTypeBlittableMessage), Resources.ResourceManager, typeof(Resources)),
Category,
Expand All @@ -66,7 +67,7 @@ public class ManualTypeMarshallingAnalyzer : DiagnosticAnalyzer

public readonly static DiagnosticDescriptor NativeTypeMustBePointerSizedRule =
new DiagnosticDescriptor(
"INTEROPGEN006",
Prefix + "006",
"NativeTypeMustBePointerSized",
new LocalizableResourceString(nameof(Resources.NativeTypeMustBePointerSizedMessage), Resources.ResourceManager, typeof(Resources)),
Category,
Expand All @@ -76,7 +77,7 @@ public class ManualTypeMarshallingAnalyzer : DiagnosticAnalyzer

public readonly static DiagnosticDescriptor NativeTypeMustHaveRequiredShapeRule =
new DiagnosticDescriptor(
"INTEROPGEN007",
Prefix + "007",
"NativeTypeMustHaveRequiredShape",
new LocalizableResourceString(nameof(Resources.NativeTypeMustHaveRequiredShapeMessage), Resources.ResourceManager, typeof(Resources)),
Category,
Expand All @@ -86,7 +87,7 @@ public class ManualTypeMarshallingAnalyzer : DiagnosticAnalyzer

public readonly static DiagnosticDescriptor ValuePropertyMustHaveSetterRule =
new DiagnosticDescriptor(
"INTEROPGEN008",
Prefix + "008",
"ValuePropertyMustHaveSetter",
new LocalizableResourceString(nameof(Resources.ValuePropertyMustHaveSetterMessage), Resources.ResourceManager, typeof(Resources)),
Category,
Expand All @@ -96,7 +97,7 @@ public class ManualTypeMarshallingAnalyzer : DiagnosticAnalyzer

public readonly static DiagnosticDescriptor ValuePropertyMustHaveGetterRule =
new DiagnosticDescriptor(
"INTEROPGEN009",
Prefix + "009",
"ValuePropertyMustHaveGetter",
new LocalizableResourceString(nameof(Resources.ValuePropertyMustHaveGetterMessage), Resources.ResourceManager, typeof(Resources)),
Category,
Expand All @@ -106,7 +107,7 @@ public class ManualTypeMarshallingAnalyzer : DiagnosticAnalyzer

public readonly static DiagnosticDescriptor GetPinnableReferenceShouldSupportAllocatingMarshallingFallbackRule =
new DiagnosticDescriptor(
"INTEROPGEN010",
Prefix + "010",
"GetPinnableReferenceShouldSupportAllocatingMarshallingFallback",
new LocalizableResourceString(nameof(Resources.GetPinnableReferenceShouldSupportAllocatingMarshallingFallbackMessage), Resources.ResourceManager, typeof(Resources)),
Category,
Expand All @@ -116,7 +117,7 @@ public class ManualTypeMarshallingAnalyzer : DiagnosticAnalyzer

public readonly static DiagnosticDescriptor StackallocMarshallingShouldSupportAllocatingMarshallingFallbackRule =
new DiagnosticDescriptor(
"INTEROPGEN011",
Prefix + "011",
"StackallocMarshallingShouldSupportAllocatingMarshallingFallback",
new LocalizableResourceString(nameof(Resources.StackallocMarshallingShouldSupportAllocatingMarshallingFallbackMessage), Resources.ResourceManager, typeof(Resources)),
Category,
Expand All @@ -126,7 +127,7 @@ public class ManualTypeMarshallingAnalyzer : DiagnosticAnalyzer

public readonly static DiagnosticDescriptor StackallocConstructorMustHaveStackBufferSizeConstantRule =
new DiagnosticDescriptor(
"INTEROPGEN012",
Prefix + "012",
"StackallocConstructorMustHaveStackBufferSizeConstant",
new LocalizableResourceString(nameof(Resources.StackallocConstructorMustHaveStackBufferSizeConstantMessage), Resources.ResourceManager, typeof(Resources)),
Category,
Expand Down

0 comments on commit c89fc41

Please sign in to comment.