Skip to content

Commit

Permalink
Bugfix for #166
Browse files Browse the repository at this point in the history
Fields coming from system tables dont need a caption
API Pages dont need a caption
  • Loading branch information
StefanMaron committed Mar 5, 2022
1 parent db583a2 commit c4340e3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Design/Rule0016CheckForMissingCaptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ private void CheckForMissingCaptions(SymbolAnalysisContext context)
case ControlKind.Field:
if (CaptionIsMissing(context.Symbol, context))
if (Control.RelatedFieldSymbol != null)
{
if (CaptionIsMissing(Control.RelatedFieldSymbol, context))
RaiseCaptionWarning(context);
}
else
{
RaiseCaptionWarning(context);
}
break;

case ControlKind.Area:
Expand Down Expand Up @@ -78,6 +84,12 @@ private void CheckForMissingCaptions(SymbolAnalysisContext context)
break;
}
}
if (context.Symbol.Kind == SymbolKind.Page)
{
if (((IPageTypeSymbol)context.Symbol).PageType != PageTypeKind.API)
if (CaptionIsMissing(context.Symbol, context))
RaiseCaptionWarning(context);
}
else
{
if (CaptionIsMissing(context.Symbol, context))
Expand All @@ -87,6 +99,15 @@ private void CheckForMissingCaptions(SymbolAnalysisContext context)

private bool CaptionIsMissing(ISymbol Symbol, SymbolAnalysisContext context)
{
try
{
if (Symbol.ContainingType.Kind == SymbolKind.Table)
if (((ITableTypeSymbol)Symbol.ContainingType).Id >= 2000000000)
return false;
}
catch (NullReferenceException)
{ }

if (Symbol.GetBooleanPropertyValue(PropertyKind.ShowCaption) != false)
if (Symbol.GetProperty(PropertyKind.Caption) == null && Symbol.GetProperty(PropertyKind.CaptionClass) == null)
return true;
Expand Down

0 comments on commit c4340e3

Please sign in to comment.