private void AnalyzeSimpleBaseType(
            SyntaxNodeAnalysisContext context,
            IImmutableSet <INamedTypeSymbol> disallowedTypes
            )
        {
            SimpleBaseTypeSyntax baseTypeSyntax = (SimpleBaseTypeSyntax)context.Node;
            SymbolInfo           baseTypeSymbol = context.SemanticModel.GetSymbolInfo(baseTypeSyntax.Type);

            INamedTypeSymbol baseSymbol = (baseTypeSymbol.Symbol as INamedTypeSymbol);

            if (baseSymbol.IsNullOrErrorType())
            {
                return;
            }

            if (!disallowedTypes.Contains(baseSymbol))
            {
                return;
            }

            Diagnostic diagnostic = Diagnostic.Create(
                Diagnostics.EventHandlerDisallowed,
                baseTypeSyntax.GetLocation(),
                baseSymbol.ToDisplayString()
                );

            context.ReportDiagnostic(diagnostic);
        }
        /// <summary>
        /// Checks if symbol under carret is object mapper interface.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="context">The context.</param>
        private static void CheckForObjectMapperBaseInterface(SimpleBaseTypeSyntax node, SyntaxNodeAnalysisContext context)
        {
            SimpleNameSyntax sns = (node.Type as SimpleNameSyntax) ?? (node.Type as QualifiedNameSyntax).Right;
            var className        = sns?.Identifier.Text;

            if (className != "IObjectMapper" && className != "IObjectMapperAdapter")
            {
                return;
            }
            var symbol = context.SemanticModel.GetSymbolInfo(sns).Symbol as INamedTypeSymbol;

            if (symbol == null || symbol.TypeKind != TypeKind.Interface || !symbol.IsGenericType)
            {
                return;
            }

            var fullSymbolName = symbol.OriginalDefinition.ToDisplayString();

            if (fullSymbolName != "ObjectMapper.Framework.IObjectMapper<T>" && fullSymbolName != "ObjectMapper.Framework.IObjectMapperAdapter<T, U>")
            {
                return;
            }

            if (!FrameworkHelpers.IsObjectMapperFrameworkAssembly(symbol.OriginalDefinition.ContainingAssembly))
            {
                return;
            }

            var diagnostic = Diagnostic.Create(Rule, node.GetLocation());

            context.ReportDiagnostic(diagnostic);
        }
        private void AnalyzeSimpleBaseType(
            SyntaxNodeAnalysisContext context,
            INamedTypeSymbol featureDefinitionType
            )
        {
            SimpleBaseTypeSyntax baseTypeSyntax = (SimpleBaseTypeSyntax)context.Node;
            SymbolInfo           baseTypeSymbol = context.SemanticModel.GetSymbolInfo(baseTypeSyntax.Type);

            INamedTypeSymbol baseSymbol = (baseTypeSymbol.Symbol as INamedTypeSymbol);

            if (baseSymbol.IsNullOrErrorType())
            {
                return;
            }

            ISymbol originalSymbol = baseSymbol.OriginalDefinition;

            if (originalSymbol.IsNullOrErrorType())
            {
                return;
            }

            if (!originalSymbol.Equals(featureDefinitionType, SymbolEqualityComparer.Default))
            {
                return;
            }

            ISymbol valueTypeSymbol = baseSymbol.TypeArguments[0];

            if (valueTypeSymbol.IsNullOrErrorType())
            {
                return;
            }

            string valueType = valueTypeSymbol.ToDisplayString();

            if (ValidTypes.Contains(valueType))
            {
                return;
            }

            Diagnostic diagnostic = Diagnostic.Create(
                Diagnostics.InvalidLaunchDarklyFeatureDefinition,
                baseTypeSyntax.GetLocation(),
                valueType
                );

            context.ReportDiagnostic(diagnostic);
        }
        private void AnalyzeSimpleBaseType(
            SyntaxNodeAnalysisContext context,
            INamedTypeSymbol featureInterfaceSymbol
            )
        {
            SimpleBaseTypeSyntax baseTypeSyntax = (SimpleBaseTypeSyntax)context.Node;
            SymbolInfo           baseTypeSymbol = context.SemanticModel.GetSymbolInfo(baseTypeSyntax.Type);

            ISymbol baseSymbol = baseTypeSymbol.Symbol;

            if (baseSymbol.IsNullOrErrorType())
            {
                return;
            }

            if (!baseSymbol.Equals(featureInterfaceSymbol))
            {
                return;
            }

            SyntaxNode classNode = baseTypeSyntax.Parent.Parent;

            ISymbol featureSymbol = context.SemanticModel.GetDeclaredSymbol(classNode);

            if (featureSymbol.IsNullOrErrorType())
            {
                return;
            }

            string featureName = featureSymbol.ToDisplayString();

            if (LegacyFeatureTypes.Types.Contains(featureName))
            {
                return;
            }

            Diagnostic diagnostic = Diagnostic.Create(
                Diagnostics.ObsoleteLaunchDarklyFramework,
                baseTypeSyntax.GetLocation()
                );

            context.ReportDiagnostic(diagnostic);
        }
        /// <summary>
        /// Checks if symbol under carret is object mapper interface.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="context">The context.</param>
        private static void CheckForObjectMapperBaseInterface(SimpleBaseTypeSyntax node, SyntaxNodeAnalysisContext context)
        {
            SimpleNameSyntax sns = (node.Type as SimpleNameSyntax) ?? (node.Type as QualifiedNameSyntax).Right;
            var className = sns?.Identifier.Text;
            if (className != "IObjectMapper" && className != "IObjectMapperAdapter")
            {
                return;
            }
            var symbol = context.SemanticModel.GetSymbolInfo(sns).Symbol as INamedTypeSymbol;
            if (symbol == null || symbol.TypeKind != TypeKind.Interface || !symbol.IsGenericType)
            {
                return;
            }

            var fullSymbolName = symbol.OriginalDefinition.ToDisplayString();
            if (fullSymbolName != "ObjectMapper.Framework.IObjectMapper<T>" && fullSymbolName != "ObjectMapper.Framework.IObjectMapperAdapter<T, U>")
            {
                return;
            }

            if (!FrameworkHelpers.IsObjectMapperFrameworkAssembly(symbol.OriginalDefinition.ContainingAssembly))
            {
                return;
            }

            var diagnostic = Diagnostic.Create(Rule, node.GetLocation());
            context.ReportDiagnostic(diagnostic);
        }