private void Analyze( SyntaxNodeAnalysisContext context, PropertyDeclarationSyntax propertyDeclaration, IPropertySymbol property) { if (property.ContainingType is null) { return; } if (property.ContainingType.IsAbstract) { return; } if (!CommandParameterSymbol.IsParameterProperty(property)) { return; } var isInsideCommand = property .ContainingType .AllInterfaces .Any(s => s.DisplayNameMatches(SymbolNames.CliFxCommandInterface)); if (!isInsideCommand) { context.ReportDiagnostic(CreateDiagnostic(propertyDeclaration.GetLocation())); } }
private void Analyze( SyntaxNodeAnalysisContext context, PropertyDeclarationSyntax propertyDeclaration, IPropertySymbol property) { if (property.ContainingType is null) { return; } if (!CommandParameterSymbol.IsParameterProperty(property)) { return; } if (IsScalar(property.Type)) { return; } var otherProperties = property .ContainingType .GetMembers() .OfType <IPropertySymbol>() .Where(m => !m.Equals(property, SymbolEqualityComparer.Default)) .ToArray(); foreach (var otherProperty in otherProperties) { if (!CommandParameterSymbol.IsParameterProperty(otherProperty)) { continue; } if (!IsScalar(otherProperty.Type)) { context.ReportDiagnostic(CreateDiagnostic(propertyDeclaration.GetLocation())); } } }