Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/Aspire.Hosting.Analyzers/AnalyzerReleases.Unshipped.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
; Unshipped analyzer release
; Unshipped analyzer release
; https://github.com/dotnet/roslyn/blob/main/src/RoslynAnalyzers/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md

### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
ASPIRE007 | Design | Error | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIRE007)
ASPIRE008 | Design | Error | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIRE008)
ASPIRE009 | Design | Error | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIRE009)
ASPIRE010 | Design | Error | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIRE010)
ASPIRE011 | Design | Warning | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIRE011)
ASPIRE012 | Design | Warning | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIRE012)
ASPIRE013 | Design | Warning | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIRE013)
ASPIRE014 | Design | Warning | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIRE014)
ASPIRE015 | Design | Warning | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIRE015)
ASPIREEXPORT001 | Design | Error | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIREEXPORT001)
ASPIREEXPORT002 | Design | Error | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIREEXPORT002)
ASPIREEXPORT003 | Design | Error | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIREEXPORT003)
ASPIREEXPORT004 | Design | Error | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIREEXPORT004)
ASPIREEXPORT005 | Design | Warning | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIREEXPORT005)
ASPIREEXPORT006 | Design | Warning | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIREEXPORT006)
ASPIREEXPORT007 | Design | Warning | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIREEXPORT007)
ASPIREEXPORT008 | Design | Warning | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIREEXPORT008)
ASPIREEXPORT009 | Design | Warning | AspireExportAnalyzer, [Documentation](https://aka.ms/aspire/diagnostics/ASPIREEXPORT009)
18 changes: 9 additions & 9 deletions src/Aspire.Hosting.Analyzers/AspireExportAnalyzer.Diagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public partial class AspireExportAnalyzer
{
internal static class Diagnostics
{
private const string ExportMethodMustBeStaticId = "ASPIRE007";
private const string ExportMethodMustBeStaticId = "ASPIREEXPORT001";
internal static readonly DiagnosticDescriptor s_exportMethodMustBeStatic = new(
id: ExportMethodMustBeStaticId,
title: "AspireExport method must be static",
Expand All @@ -20,7 +20,7 @@ internal static class Diagnostics
isEnabledByDefault: true,
helpLinkUri: $"https://aka.ms/aspire/diagnostics/{ExportMethodMustBeStaticId}");

private const string InvalidExportIdFormatId = "ASPIRE008";
private const string InvalidExportIdFormatId = "ASPIREEXPORT002";
internal static readonly DiagnosticDescriptor s_invalidExportIdFormat = new(
id: InvalidExportIdFormatId,
title: "Invalid AspireExport ID format",
Expand All @@ -30,7 +30,7 @@ internal static class Diagnostics
isEnabledByDefault: true,
helpLinkUri: $"https://aka.ms/aspire/diagnostics/{InvalidExportIdFormatId}");

private const string ReturnTypeMustBeAtsCompatibleId = "ASPIRE009";
private const string ReturnTypeMustBeAtsCompatibleId = "ASPIREEXPORT003";
internal static readonly DiagnosticDescriptor s_returnTypeMustBeAtsCompatible = new(
id: ReturnTypeMustBeAtsCompatibleId,
title: "AspireExport return type must be ATS-compatible",
Expand All @@ -40,7 +40,7 @@ internal static class Diagnostics
isEnabledByDefault: true,
helpLinkUri: $"https://aka.ms/aspire/diagnostics/{ReturnTypeMustBeAtsCompatibleId}");

private const string ParameterTypeMustBeAtsCompatibleId = "ASPIRE010";
private const string ParameterTypeMustBeAtsCompatibleId = "ASPIREEXPORT004";
internal static readonly DiagnosticDescriptor s_parameterTypeMustBeAtsCompatible = new(
id: ParameterTypeMustBeAtsCompatibleId,
title: "AspireExport parameter type must be ATS-compatible",
Expand All @@ -50,7 +50,7 @@ internal static class Diagnostics
isEnabledByDefault: true,
helpLinkUri: $"https://aka.ms/aspire/diagnostics/{ParameterTypeMustBeAtsCompatibleId}");

private const string UnionRequiresAtLeastTwoTypesId = "ASPIRE011";
private const string UnionRequiresAtLeastTwoTypesId = "ASPIREEXPORT005";
internal static readonly DiagnosticDescriptor s_unionRequiresAtLeastTwoTypes = new(
id: UnionRequiresAtLeastTwoTypesId,
title: "AspireUnion requires at least 2 types",
Expand All @@ -60,7 +60,7 @@ internal static class Diagnostics
isEnabledByDefault: true,
helpLinkUri: $"https://aka.ms/aspire/diagnostics/{UnionRequiresAtLeastTwoTypesId}");

private const string UnionTypeMustBeAtsCompatibleId = "ASPIRE012";
private const string UnionTypeMustBeAtsCompatibleId = "ASPIREEXPORT006";
internal static readonly DiagnosticDescriptor s_unionTypeMustBeAtsCompatible = new(
id: UnionTypeMustBeAtsCompatibleId,
title: "AspireUnion type must be ATS-compatible",
Expand All @@ -70,7 +70,7 @@ internal static class Diagnostics
isEnabledByDefault: true,
helpLinkUri: $"https://aka.ms/aspire/diagnostics/{UnionTypeMustBeAtsCompatibleId}");

private const string DuplicateExportIdId = "ASPIRE013";
private const string DuplicateExportIdId = "ASPIREEXPORT007";
internal static readonly DiagnosticDescriptor s_duplicateExportId = new(
id: DuplicateExportIdId,
title: "Duplicate AspireExport ID for same target type",
Expand All @@ -81,7 +81,7 @@ internal static class Diagnostics
helpLinkUri: $"https://aka.ms/aspire/diagnostics/{DuplicateExportIdId}",
customTags: [WellKnownDiagnosticTags.CompilationEnd]);

private const string MissingExportAttributeId = "ASPIRE014";
private const string MissingExportAttributeId = "ASPIREEXPORT008";
internal static readonly DiagnosticDescriptor s_missingExportAttribute = new(
id: MissingExportAttributeId,
title: "Extension method missing AspireExport or AspireExportIgnore attribute",
Expand All @@ -91,7 +91,7 @@ internal static class Diagnostics
isEnabledByDefault: true,
helpLinkUri: $"https://aka.ms/aspire/diagnostics/{MissingExportAttributeId}");

private const string ExportNameShouldBeUniqueId = "ASPIRE015";
private const string ExportNameShouldBeUniqueId = "ASPIREEXPORT009";
internal static readonly DiagnosticDescriptor s_exportNameShouldBeUnique = new(
id: ExportNameShouldBeUniqueId,
title: "Export name should be unique for methods targeting a specific resource type",
Expand Down
20 changes: 10 additions & 10 deletions src/Aspire.Hosting.Analyzers/AspireExportAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private void AnalyzeCompilationStart(CompilationStartAnalysisContext context)
return;
}

// Try to get AspireExportIgnoreAttribute for ASPIRE014
// Try to get AspireExportIgnoreAttribute for ASPIREEXPORT008
INamedTypeSymbol? aspireExportIgnoreAttribute = null;
try
{
Expand All @@ -55,7 +55,7 @@ private void AnalyzeCompilationStart(CompilationStartAnalysisContext context)
// Type not found, missing attribute check won't run
}

// Try to get AspireUnionAttribute for ASPIRE011/012 validation
// Try to get AspireUnionAttribute for ASPIREEXPORT005/006 validation
INamedTypeSymbol? aspireUnionAttribute = null;
try
{
Expand All @@ -66,7 +66,7 @@ private void AnalyzeCompilationStart(CompilationStartAnalysisContext context)
// Type not found, union validation won't run
}

// Collection for ASPIRE013: track export IDs to detect duplicates
// Collection for ASPIREEXPORT007: track export IDs to detect duplicates
// Key: (exportId, targetTypeFullName), Value: list of (method, location)
var exportsByKey = new ConcurrentDictionary<(string ExportId, string TargetType), ConcurrentBag<(IMethodSymbol Method, Location Location)>>();

Expand Down Expand Up @@ -109,7 +109,7 @@ private static void AnalyzeMethod(
}
}

// ASPIRE014: Check for missing export attributes on builder extension methods
// ASPIREEXPORT008: Check for missing export attributes on builder extension methods
if (exportAttribute is null && !hasExportIgnore && !isObsolete)
{
AnalyzeMissingExportAttribute(context, method, wellKnownTypes, aspireExportAttribute);
Expand Down Expand Up @@ -165,14 +165,14 @@ private static void AnalyzeMethod(
method.Name));
}

// Rule 5 (ASPIRE011/012): Validate [AspireUnion] on parameters
// Rule 5 (ASPIREEXPORT005/006): Validate [AspireUnion] on parameters
if (aspireUnionAttribute is not null)
{
AnalyzeUnionAttribute(context, parameter.GetAttributes(), aspireUnionAttribute, wellKnownTypes, aspireExportAttribute);
}
}

// Rule 6 (ASPIRE013): Track export for duplicate detection
// Rule 6 (ASPIREEXPORT007): Track export for duplicate detection
if (exportId is not null && method.IsExtensionMethod && method.Parameters.Length > 0)
{
var targetType = method.Parameters[0].Type;
Expand All @@ -182,7 +182,7 @@ private static void AnalyzeMethod(
bag.Add((method, location));
}

// Rule 7 (ASPIRE015): Warn when export name may collide across integrations
// Rule 7 (ASPIREEXPORT009): Warn when export name may collide across integrations
if (exportId is not null && method.IsExtensionMethod && method.Parameters.Length > 0)
{
AnalyzeExportNameUniqueness(context, method, exportId, wellKnownTypes, location);
Expand Down Expand Up @@ -537,7 +537,7 @@ private static void AnalyzeUnionAttribute(
// Get the types from the constructor argument (params Type[] types)
if (attr.ConstructorArguments.Length == 0)
{
// No arguments - report ASPIRE011
// No arguments - report ASPIREEXPORT005
context.ReportDiagnostic(Diagnostic.Create(
Diagnostics.s_unionRequiresAtLeastTwoTypes,
attrLocation,
Expand All @@ -553,7 +553,7 @@ private static void AnalyzeUnionAttribute(

var types = typesArg.Values;

// ASPIRE011: Check that we have at least 2 types
// ASPIREEXPORT005: Check that we have at least 2 types
if (types.Length < 2)
{
context.ReportDiagnostic(Diagnostic.Create(
Expand All @@ -562,7 +562,7 @@ private static void AnalyzeUnionAttribute(
types.Length));
}

// ASPIRE012: Check that each type is ATS-compatible
// ASPIREEXPORT006: Check that each type is ATS-compatible
foreach (var typeConstant in types)
{
if (typeConstant.Value is INamedTypeSymbol typeSymbol)
Expand Down
Loading
Loading