Skip to content

Commit

Permalink
Merge pull request #427 from StefanMaron/development
Browse files Browse the repository at this point in the history
Resolve false positives on rule0004 (workspaces)
  • Loading branch information
Arthurvdv authored Dec 13, 2023
2 parents c8e8f2b + 32d8997 commit 561b7fb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Design/Rule0004LookupPageIdAndDrillDownPageId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ public class Rule0004LookupPageIdAndDrillDownPageId : DiagnosticAnalyzer
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; } = ImmutableArray.Create<DiagnosticDescriptor>(DiagnosticDescriptors.Rule0004LookupPageIdAndDrillDownPageId);

public override void Initialize(AnalysisContext context)
=> context.RegisterSymbolAction(new Action<SymbolAnalysisContext>(this.CheckForLookupPageIdAndDrilldownPageId), SymbolKind.Page);
=> context.RegisterSymbolAction(new Action<SymbolAnalysisContext>(this.CheckForLookupPageIdAndDrillDownPageId), SymbolKind.Page);

private void CheckForLookupPageIdAndDrilldownPageId(SymbolAnalysisContext context)
private void CheckForLookupPageIdAndDrillDownPageId(SymbolAnalysisContext context)
{
if (context.Symbol.IsObsoletePending || context.Symbol.IsObsoleteRemoved) return;
IPageTypeSymbol pageTypeSymbol = (IPageTypeSymbol)context.Symbol;
if (pageTypeSymbol.PageType == PageTypeKind.List && pageTypeSymbol.RelatedTable != null)
CheckTable(pageTypeSymbol.RelatedTable, ref context);
if (pageTypeSymbol.PageType != PageTypeKind.List || pageTypeSymbol.RelatedTable == null) return;
if (pageTypeSymbol.RelatedTable.ContainingModule != context.Symbol.ContainingModule) return;
CheckTable(pageTypeSymbol.RelatedTable, ref context);
}

private void CheckTable(ITableTypeSymbol table, ref SymbolAnalysisContext context)
Expand Down

0 comments on commit 561b7fb

Please sign in to comment.