private static void CheckInvocationInsideMethod(SyntaxNodeAnalysisContext context,
                                                        IMethodSymbol methodSymbol)
        {
            var invocation    = (InvocationExpressionSyntax)context.Node;
            var invokedMethod = context.SemanticModel.GetSymbolInfo(invocation).Symbol as IMethodSymbol;

            if (invokedMethod == null ||
                invokedMethod.Name != methodSymbol.Name)
            {
                return;
            }

            var memberAccess = invocation.Expression as MemberAccessExpressionSyntax;

            var baseCall = memberAccess?.Expression as BaseExpressionSyntax;

            if (baseCall == null)
            {
                return;
            }

            var objectType = invokedMethod.ContainingType;

            if (objectType != null &&
                !objectType.Is(KnownType.System_Object) &&
                GetHashCodeEqualsOverride.IsEqualsCallInGuardCondition(invocation, invokedMethod))
            {
                context.ReportDiagnostic(Diagnostic.Create(Rule, invocation.GetLocation()));
            }
        }
        protected override void Initialize(SonarAnalysisContext context)
        {
            context.RegisterCodeBlockStartActionInNonGenerated <SyntaxKind>(
                cb =>
            {
                var methodDeclaration = cb.CodeBlock as MethodDeclarationSyntax;
                if (methodDeclaration == null)
                {
                    return;
                }

                var methodSymbol = cb.OwningSymbol as IMethodSymbol;
                if (methodSymbol == null ||
                    !GetHashCodeEqualsOverride.MethodIsRelevant(methodSymbol, MethodNames))
                {
                    return;
                }

                cb.RegisterSyntaxNodeAction(
                    c =>
                {
                    CheckInvocationInsideMethod(c, methodSymbol);
                },
                    SyntaxKind.InvocationExpression);
            });
        }