private DiagnosticDescriptor GetRemoveQualificationDiagnosticDescriptor(SemanticModel model, SyntaxNode node, OptionSet optionSet, CancellationToken cancellationToken)
        {
            var symbolInfo = model.GetSymbolInfo(node, cancellationToken);

            if (symbolInfo.Symbol == null)
            {
                return(null);
            }

            var applicableOption = QualifyMemberAccessDiagnosticAnalyzerBase <TLanguageKindEnum> .GetApplicableOptionFromSymbolKind(symbolInfo.Symbol.Kind);

            var optionValue = optionSet.GetOption(applicableOption, GetLanguageName());

            switch (optionValue.Notification.Value)
            {
            case DiagnosticSeverity.Hidden:
                return(s_descriptorRemoveThisOrMeHidden);

            case DiagnosticSeverity.Info:
                return(s_descriptorRemoveThisOrMeInfo);

            case DiagnosticSeverity.Warning:
                return(s_descriptorRemoveThisOrMeWarning);

            case DiagnosticSeverity.Error:
                return(s_descriptorRemoveThisOrMeError);

            default:
                throw ExceptionUtilities.Unreachable;
            }
        }
Ejemplo n.º 2
0
        private DiagnosticDescriptor GetRemoveQualificationDiagnosticDescriptor(SemanticModel model, SyntaxNode node, OptionSet optionSet, CancellationToken cancellationToken)
        {
            var symbolInfo = model.GetSymbolInfo(node, cancellationToken);

            if (symbolInfo.Symbol == null)
            {
                return(null);
            }

            var applicableOption = QualifyMemberAccessDiagnosticAnalyzerBase <TLanguageKindEnum> .GetApplicableOptionFromSymbolKind(symbolInfo.Symbol.Kind);

            var optionValue = optionSet.GetOption(applicableOption, GetLanguageName());
            var severity    = optionValue.Notification.Value;

            return(new DiagnosticDescriptor(
                       IDEDiagnosticIds.RemoveQualificationDiagnosticId,
                       s_localizableTitleRemoveThisOrMe,
                       s_localizableMessage,
                       DiagnosticCategory.Style,
                       severity,
                       isEnabledByDefault: true,
                       customTags: DiagnosticCustomTags.Unnecessary));
        }