2137 references to ReportDiagnostic
AnalyzerRunner (2)
DiagnosticAnalyzerRunner.cs (2)
50.SetItem("AD0001", ReportDiagnostic.Error) 51.SetItem("AD0002", ReportDiagnostic.Error);
BuildActionTelemetryTable (27)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\EditorConfigSeverityStrings.cs (6)
18public static bool TryParse(string editorconfigSeverityString, out ReportDiagnostic reportDiagnostic) 23reportDiagnostic = ReportDiagnostic.Suppress; 28reportDiagnostic = ReportDiagnostic.Hidden; 32reportDiagnostic = ReportDiagnostic.Info; 36reportDiagnostic = ReportDiagnostic.Warn; 40reportDiagnostic = ReportDiagnostic.Error;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (21)
34public static ReportDiagnostic GetEffectiveSeverity( 38ImmutableDictionary<string, ReportDiagnostic>? treeOptions) 40var effectiveSeverity = descriptor.GetEffectiveSeverity(compilationOptions); 45(!compilationOptions.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out var reportDiagnostic) || 46reportDiagnostic == ReportDiagnostic.Default)) 48if (treeOptions.TryGetValue(descriptor.Id, out reportDiagnostic) && reportDiagnostic != ReportDiagnostic.Default || 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default); 64public static ReportDiagnostic GetEffectiveSeverity(this DiagnosticDescriptor descriptor, CompilationOptions compilationOptions, SyntaxTree tree, AnalyzerOptions analyzerOptions) 66var effectiveSeverity = descriptor.GetEffectiveSeverity(compilationOptions); 70if (!compilationOptions.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out var reportDiagnostic) || 71reportDiagnostic == ReportDiagnostic.Default) 78var severityInEditorConfig = descriptor.GetEffectiveSeverity(analyzerConfigOptions, providerAndTree); 79if (severityInEditorConfig != ReportDiagnostic.Default) 86var severityInGlobalConfig = descriptor.GetEffectiveSeverity(analyzerOptions.AnalyzerConfigOptionsProvider.GlobalOptions, providerAndTree); 87if (severityInGlobalConfig != ReportDiagnostic.Default) 102EditorConfigSeverityStrings.TryParse(value, out var severity)) 145public static ReportDiagnostic GetEffectiveSeverity( 150ReportDiagnostic severity; 182return ReportDiagnostic.Default; 203return ReportDiagnostic.Default; 217out ReportDiagnostic severity)
CodeStyleConfigFileGenerator (13)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\EditorConfigSeverityStrings.cs (6)
18public static bool TryParse(string editorconfigSeverityString, out ReportDiagnostic reportDiagnostic) 23reportDiagnostic = ReportDiagnostic.Suppress; 28reportDiagnostic = ReportDiagnostic.Hidden; 32reportDiagnostic = ReportDiagnostic.Info; 36reportDiagnostic = ReportDiagnostic.Warn; 40reportDiagnostic = ReportDiagnostic.Error;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticSeverityExtensions_Shared.cs (7)
13/// Returns the equivalent <see cref="ReportDiagnostic"/> for a <see cref="DiagnosticSeverity"/> value. 17/// The equivalent <see cref="ReportDiagnostic"/> for the <see cref="DiagnosticSeverity"/> value. 22public static ReportDiagnostic ToReportDiagnostic(this DiagnosticSeverity diagnosticSeverity) 25DiagnosticSeverity.Hidden => ReportDiagnostic.Hidden, 26DiagnosticSeverity.Info => ReportDiagnostic.Info, 27DiagnosticSeverity.Warning => ReportDiagnostic.Warn, 28DiagnosticSeverity.Error => ReportDiagnostic.Error,
Microsoft.AspNetCore.Analyzer.Testing (2)
DiagnosticAnalyzerRunner.cs (1)
70additionalEnabledDiagnostics.ToDictionary(s => s, s => ReportDiagnostic.Info));
DiagnosticVerifier.cs (1)
90additionalEnabledDiagnostics.ToDictionary(s => s, s => ReportDiagnostic.Info));
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (7)
CSharpCompiler.cs (7)
170new Dictionary<string, ReportDiagnostic> 172{"CS1701", ReportDiagnostic.Suppress}, // Binding redirects 173{"CS1702", ReportDiagnostic.Suppress}, 174{"CS1705", ReportDiagnostic.Suppress} 200var reportDiagnostic = dependencyContextOptions.WarningsAsErrors.Value ? 201ReportDiagnostic.Error : 202ReportDiagnostic.Default;
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (5)
CSharpCompilerTest.cs (5)
96Assert.Equal(ReportDiagnostic.Default, compilationOptions.GeneralDiagnosticOption); 102Assert.Equal(ReportDiagnostic.Suppress, item.Value); 107Assert.Equal(ReportDiagnostic.Suppress, item.Value); 112Assert.Equal(ReportDiagnostic.Suppress, item.Value); 225Assert.Equal(ReportDiagnostic.Error, compilationOptions.GeneralDiagnosticOption);
Microsoft.CodeAnalysis (186)
CommandLine\AnalyzerConfigOptionsResult.cs (1)
8using TreeOptions = System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>;
CommandLine\AnalyzerConfigSet.cs (10)
20using TreeOptions = System.Collections.Immutable.ImmutableDictionary<string, Microsoft.CodeAnalysis.ReportDiagnostic>; 55new ObjectPool<TreeOptions.Builder>(() => ImmutableDictionary.CreateBuilder<string, ReportDiagnostic>(Section.PropertiesKeyComparer)); 331internal static bool TryParseSeverity(string value, out ReportDiagnostic severity) 336severity = ReportDiagnostic.Default; 341severity = ReportDiagnostic.Error; 346severity = ReportDiagnostic.Warn; 351severity = ReportDiagnostic.Info; 356severity = ReportDiagnostic.Hidden; 361severity = ReportDiagnostic.Suppress; 426if (TryParseSeverity(value, out ReportDiagnostic severity))
CommandLine\CommandLineParser.cs (2)
1315internal ReportDiagnostic GetDiagnosticOptionsFromRulesetFile(string? fullPath, out Dictionary<string, ReportDiagnostic> diagnosticOptions, IList<Diagnostic> diagnostics)
CommandLine\ErrorLogger.cs (1)
37ImmutableHashSet<ReportDiagnostic>? EffectiveSeverities,
CommandLine\SarifV2ErrorLogger.cs (7)
230private ImmutableArray<(string DescriptorId, int DescriptorIndex, ImmutableHashSet<ReportDiagnostic> EffectiveSeverities)> WriteRules() 232var effectiveSeveritiesBuilder = ArrayBuilder<(string DescriptorId, int DescriptorIndex, ImmutableHashSet<ReportDiagnostic> EffectiveSeverities)>.GetInstance(_descriptors.Count); 333var defaultSeverity = descriptor.IsEnabledByDefault ? DiagnosticDescriptor.MapSeverityToReport(descriptor.DefaultSeverity) : ReportDiagnostic.Suppress; 348private void WriteInvocations(ImmutableArray<(string DescriptorId, int DescriptorIndex, ImmutableHashSet<ReportDiagnostic> EffectiveSeverities)> effectiveSeverities) 389foreach (var severity in severities.OrderBy(Comparer<ReportDiagnostic>.Default))
Compilation\CompilationOptions.cs (10)
143public ReportDiagnostic GeneralDiagnosticOption { get; protected set; } 195public ImmutableDictionary<string, ReportDiagnostic> SpecificDiagnosticOptions { get; protected set; } 281ReportDiagnostic generalDiagnosticOption, 283ImmutableDictionary<string, ReportDiagnostic> specificDiagnosticOptions, 382public CompilationOptions WithGeneralDiagnosticOption(ReportDiagnostic value) 390public CompilationOptions WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>? value) 398public CompilationOptions WithSpecificDiagnosticOptions(IEnumerable<KeyValuePair<string, ReportDiagnostic>> value) 540protected abstract CompilationOptions CommonWithGeneralDiagnosticOption(ReportDiagnostic generalDiagnosticOption); 541protected abstract CompilationOptions CommonWithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>? specificDiagnosticOptions); 542protected abstract CompilationOptions CommonWithSpecificDiagnosticOptions(IEnumerable<KeyValuePair<string, ReportDiagnostic>> specificDiagnosticOptions);
Compilation\SyntaxTreeOptionsProvider.cs (7)
21public abstract bool TryGetDiagnosticValue(SyntaxTree tree, string diagnosticId, CancellationToken cancellationToken, out ReportDiagnostic severity); 26public abstract bool TryGetGlobalDiagnosticValue(string diagnosticId, CancellationToken cancellationToken, out ReportDiagnostic severity); 34public readonly ImmutableDictionary<string, ReportDiagnostic> DiagnosticOptions; 77public override bool TryGetDiagnosticValue(SyntaxTree tree, string diagnosticId, CancellationToken _, out ReportDiagnostic severity) 83severity = ReportDiagnostic.Default; 87public override bool TryGetGlobalDiagnosticValue(string diagnosticId, CancellationToken _, out ReportDiagnostic severity) 93severity = ReportDiagnostic.Default;
Diagnostic\CommonMessageProvider.cs (7)
127public abstract ReportDiagnostic GetDiagnosticReport(DiagnosticInfo diagnosticInfo, CompilationOptions options); 135var report = this.GetDiagnosticReport(diagnosticInfo, options); 138case ReportDiagnostic.Error: 140case ReportDiagnostic.Warn: 142case ReportDiagnostic.Info: 144case ReportDiagnostic.Hidden: 146case ReportDiagnostic.Suppress:
Diagnostic\Diagnostic.cs (7)
527internal Diagnostic? WithReportDiagnostic(ReportDiagnostic reportAction) 531case ReportDiagnostic.Suppress: 534case ReportDiagnostic.Error: 536case ReportDiagnostic.Default: 538case ReportDiagnostic.Warn: 540case ReportDiagnostic.Info: 542case ReportDiagnostic.Hidden:
Diagnostic\DiagnosticDescriptor.cs (13)
235public ReportDiagnostic GetEffectiveSeverity(CompilationOptions compilationOptions) 245return effectiveDiagnostic != null ? MapSeverityToReport(effectiveDiagnostic.Severity) : ReportDiagnostic.Suppress; 249internal static ReportDiagnostic MapSeverityToReport(DiagnosticSeverity severity) 254return ReportDiagnostic.Hidden; 256return ReportDiagnostic.Info; 258return ReportDiagnostic.Warn; 260return ReportDiagnostic.Error; 266internal static DiagnosticSeverity? MapReportToSeverity(ReportDiagnostic severity) 270case ReportDiagnostic.Error: 272case ReportDiagnostic.Warn: 274case ReportDiagnostic.Info: 276case ReportDiagnostic.Hidden: 278case ReportDiagnostic.Suppress:
Diagnostic\SeverityFilter.cs (5)
23internal static bool Contains(this SeverityFilter severityFilter, ReportDiagnostic severity) 27ReportDiagnostic.Hidden => (severityFilter & SeverityFilter.Hidden) != 0, 28ReportDiagnostic.Info => (severityFilter & SeverityFilter.Info) != 0, 35if (!severityFilter.Contains(ReportDiagnostic.Hidden)) 39else if (!severityFilter.Contains(ReportDiagnostic.Info))
Diagnostic\SuppressionDescriptor.cs (2)
109return compilationOptions.SpecificDiagnosticOptions.TryGetValue(Id, out var reportDiagnostic) && 110reportDiagnostic == ReportDiagnostic.Suppress;
DiagnosticAnalyzer\AnalyzerDriver.cs (22)
373Debug.Assert(!severityFilter.Contains(ReportDiagnostic.Suppress)); 374Debug.Assert(!severityFilter.Contains(ReportDiagnostic.Default)); 940static ImmutableHashSet<ReportDiagnostic> GetEffectiveSeverities( 946var defaultSeverity = descriptor.IsEnabledByDefault ? 948ReportDiagnostic.Suppress; 953if (compilation.Options.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out var severity) || 956if (severity != ReportDiagnostic.Default) 963if (defaultSeverity == ReportDiagnostic.Warn && 964compilation.Options.GeneralDiagnosticOption == ReportDiagnostic.Error) 966defaultSeverity = ReportDiagnostic.Error; 975var builder = ImmutableHashSet.CreateBuilder<ReportDiagnostic>(); 978var severityForTree = defaultSeverity; 983Debug.Assert(severity != ReportDiagnostic.Default); 986if (severity == ReportDiagnostic.Warn && 987compilation.Options.GeneralDiagnosticOption == ReportDiagnostic.Error) 989severity = ReportDiagnostic.Error; 1393var configuredSeverity = descriptor.GetEffectiveSeverity(AnalyzerExecutor.Compilation.Options); 1394if (options.TryGetDiagnosticValue(tree, descriptor.Id, cancellationToken, out var severityFromOptions) || 1401if (!descriptor.IsEnabledByDefault && configuredSeverity == ReportDiagnostic.Default) 1403configuredSeverity = ReportDiagnostic.Suppress; 1406if (configuredSeverity != ReportDiagnostic.Suppress) 2008analyzerOptions.TryGetSeverityFromBulkConfiguration(tree, compilation, diagnostic.Descriptor, cancellationToken, out ReportDiagnostic severity))
DiagnosticAnalyzer\AnalyzerManager.cs (6)
322if (treeOptions.TryGetDiagnosticValue(tree, descriptor.Id, cancellationToken, out var configuredValue) || 325if (configuredValue != ReportDiagnostic.Suppress && !severityFilter.Contains(configuredValue)) 389if ((diagnosticOptions.TryGetValue(diag.Id, out var severity) && severity != ReportDiagnostic.Default) || 392isSuppressed = severity == ReportDiagnostic.Suppress; 396severity = isSuppressed ? ReportDiagnostic.Suppress : DiagnosticDescriptor.MapSeverityToReport(diag.DefaultSeverity);
DiagnosticAnalyzer\AnalyzerOptionsExtensions.cs (7)
35out ReportDiagnostic severity) 70if (severity == ReportDiagnostic.Warn && compilation.Options.GeneralDiagnosticOption == ReportDiagnostic.Error) 71severity = ReportDiagnostic.Error; 82if (severity == ReportDiagnostic.Warn && compilation.Options.GeneralDiagnosticOption == ReportDiagnostic.Error) 83severity = ReportDiagnostic.Error;
RuleSet\RuleSet.cs (53)
29private readonly ReportDiagnostic _generalDiagnosticOption; 33public ReportDiagnostic GeneralDiagnosticOption 38private readonly ImmutableDictionary<string, ReportDiagnostic> _specificDiagnosticOptions; 42public ImmutableDictionary<string, ReportDiagnostic> SpecificDiagnosticOptions 59public RuleSet(string filePath, ReportDiagnostic generalOption, ImmutableDictionary<string, ReportDiagnostic> specificOptions, ImmutableArray<RuleSetInclude> includes) 63_specificDiagnosticOptions = specificOptions == null ? ImmutableDictionary<string, ReportDiagnostic>.Empty : specificOptions; 70public RuleSet? WithEffectiveAction(ReportDiagnostic action) 79case ReportDiagnostic.Default: 81case ReportDiagnostic.Suppress: 83case ReportDiagnostic.Error: 84case ReportDiagnostic.Warn: 85case ReportDiagnostic.Info: 86case ReportDiagnostic.Hidden: 87var generalOption = _generalDiagnosticOption == ReportDiagnostic.Default ? ReportDiagnostic.Default : action; 91if (item.Value != ReportDiagnostic.Suppress && item.Value != ReportDiagnostic.Default) 107var effectiveGeneralOption = _generalDiagnosticOption; 108var effectiveSpecificOptions = new Dictionary<string, ReportDiagnostic>(); 119if (ruleSetInclude.Action == ReportDiagnostic.Suppress) 157if (effectiveSpecificOptions.TryGetValue(item.Key, out var value)) 225private static bool IsStricterThan(ReportDiagnostic action1, ReportDiagnostic action2) 229case ReportDiagnostic.Suppress: 231case ReportDiagnostic.Default: 232return action1 == ReportDiagnostic.Warn || action1 == ReportDiagnostic.Error || action1 == ReportDiagnostic.Info || action1 == ReportDiagnostic.Hidden; 233case ReportDiagnostic.Hidden: 234return action1 == ReportDiagnostic.Warn || action1 == ReportDiagnostic.Error || action1 == ReportDiagnostic.Info; 235case ReportDiagnostic.Info: 236return action1 == ReportDiagnostic.Warn || action1 == ReportDiagnostic.Error; 237case ReportDiagnostic.Warn: 238return action1 == ReportDiagnostic.Error; 239case ReportDiagnostic.Error: 280/// 1) A map of <paramref name="specificDiagnosticOptions"/> from rule ID to <see cref="ReportDiagnostic"/> option. 281/// 2) A global <see cref="ReportDiagnostic"/> option for all rules in the ruleset file. 283public static ReportDiagnostic GetDiagnosticOptionsFromRulesetFile(string? rulesetFileFullPath, out Dictionary<string, ReportDiagnostic> specificDiagnosticOptions) 288internal static ReportDiagnostic GetDiagnosticOptionsFromRulesetFile(string? rulesetFileFullPath, out Dictionary<string, ReportDiagnostic> diagnosticOptions, IList<Diagnostic>? diagnosticsOpt, CommonMessageProvider? messageProviderOpt) 290diagnosticOptions = new Dictionary<string, ReportDiagnostic>(); 293return ReportDiagnostic.Default; 299private static ReportDiagnostic GetDiagnosticOptionsFromRulesetFile(Dictionary<string, ReportDiagnostic> diagnosticOptions, string resolvedPath, IList<Diagnostic>? diagnosticsOpt, CommonMessageProvider? messageProviderOpt) 303var generalDiagnosticOption = ReportDiagnostic.Default;
RuleSet\RuleSetInclude.cs (3)
25private readonly ReportDiagnostic _action; 29public ReportDiagnostic Action 37public RuleSetInclude(string includePath, ReportDiagnostic action)
RuleSet\RuleSetProcessor.cs (19)
98var specificOptions = ImmutableDictionary.CreateBuilder<string, ReportDiagnostic>(); 99var generalOption = ReportDiagnostic.Default; 114var action = rule.Value; 116ReportDiagnostic existingAction; 149private static List<KeyValuePair<string, ReportDiagnostic>> ReadRules(XElement rulesNode) 154var rules = new List<KeyValuePair<string, ReportDiagnostic>>(); 178private static KeyValuePair<string, ReportDiagnostic> ReadRule(XElement ruleNode) 181ReportDiagnostic action = ReadAction(ruleNode, allowDefault: false); 183return new KeyValuePair<string, ReportDiagnostic>(ruleId, action); 194ReportDiagnostic action = ReadAction(includeNode, allowDefault: true); 205private static ReportDiagnostic ReadAction(XElement node, bool allowDefault) 211return ReportDiagnostic.Warn; 215return ReportDiagnostic.Error; 219return ReportDiagnostic.Info; 223return ReportDiagnostic.Hidden; 227return ReportDiagnostic.Suppress; 231return ReportDiagnostic.Default; 242private static ReportDiagnostic ReadIncludeAll(XElement includeAllNode)
Syntax\SyntaxTree.cs (4)
26protected internal static readonly ImmutableDictionary<string, ReportDiagnostic> EmptyDiagnosticOptions = 27ImmutableDictionary.Create<string, ReportDiagnostic>(CaseInsensitiveComparison.Comparer); 83public virtual ImmutableDictionary<string, ReportDiagnostic> DiagnosticOptions => EmptyDiagnosticOptions; 406public virtual SyntaxTree WithDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic> options)
Microsoft.CodeAnalysis.CodeStyle (127)
src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs (3)
163if (notification?.Severity == ReportDiagnostic.Suppress) 211if (severityOptionsProvider.TryGetDiagnosticValue(tree, descriptor.Id, cancellationToken, out var configuredReportDiagnostic) 246if (EditorConfigSeverityStrings.TryParse(editorConfigSeverity!, out var effectiveReportDiagnostic)
src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (3)
269var effectiveSeverity = notificationOption.Severity; 277warningLevel: effectiveSeverity.WithDefaultSeverity(descriptor.DefaultSeverity) == ReportDiagnostic.Error ? 0 : 1, 278effectiveSeverity == ReportDiagnostic.Suppress,
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (1)
142applicableRule.EnforcementLevel == ReportDiagnostic.Suppress)
src\Analyzers\Core\Analyzers\OrderModifiers\AbstractOrderModifiersDiagnosticAnalyzer.cs (1)
75if (notificationOption.Severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) == ReportDiagnostic.Hidden)
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (3)
136var effectiveSeverity = _classificationIdDescriptor.GetEffectiveSeverity(compilation.Options, tree, context.Options); 137if (effectiveSeverity is ReportDiagnostic.Warn or ReportDiagnostic.Error)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
104compilationWithAnalyzers.Compilation.Options.SyntaxTreeOptionsProvider.TryGetDiagnosticValue(tree, IDEDiagnosticIds.RemoveUnnecessarySuppressionDiagnosticId, cancellationToken, out var severity) || 107if (severity == ReportDiagnostic.Suppress)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (6)
226option.Notification.Severity == ReportDiagnostic.Suppress) 256Debug.Assert(unusedValueExpressionStatementSeverity.Severity != ReportDiagnostic.Suppress || 257unusedValueAssignmentSeverity.Severity != ReportDiagnostic.Suppress || 258unusedParametersSeverity.Severity != ReportDiagnostic.Suppress); 279ReportDiagnostic unusedParametersSeverity) 281if (unusedParametersSeverity == ReportDiagnostic.Suppress)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (3)
164if (_options.UnusedValueExpressionStatementNotification.Severity == ReportDiagnostic.Suppress) 457if (_options.UnusedValueAssignmentSeverity.Severity == ReportDiagnostic.Suppress && 604if (_options.UnusedValueAssignmentSeverity.Severity == ReportDiagnostic.Suppress ||
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
134if (option.Notification.Severity == ReportDiagnostic.Suppress ||
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
384if (notification.Severity == ReportDiagnostic.Suppress)
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (1)
42if (option.Notification.Severity == ReportDiagnostic.Suppress)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (4)
52(true, ReportDiagnostic.Hidden) => TrueWithSilentEnforcement, 53(true, ReportDiagnostic.Info) => TrueWithSuggestionEnforcement, 54(false, ReportDiagnostic.Hidden) => FalseWithSilentEnforcement, 55(false, ReportDiagnostic.Info) => FalseWithSuggestionEnforcement,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\EditorConfigSeverityStrings.cs (6)
18public static bool TryParse(string editorconfigSeverityString, out ReportDiagnostic reportDiagnostic) 23reportDiagnostic = ReportDiagnostic.Suppress; 28reportDiagnostic = ReportDiagnostic.Hidden; 32reportDiagnostic = ReportDiagnostic.Info; 36reportDiagnostic = ReportDiagnostic.Warn; 40reportDiagnostic = ReportDiagnostic.Error;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\NotificationOption2.cs (18)
17[property: DataMember(Order = 0)] ReportDiagnostic Severity, [property: DataMember(Order = 1)] bool IsExplicitlySpecified) 20/// Notification option to disable or suppress an option with <see cref="ReportDiagnostic.Suppress"/>. 22public static NotificationOption2 None => new(ReportDiagnostic.Suppress, false); 25/// Notification option for a silent or hidden option with <see cref="ReportDiagnostic.Hidden"/>. 27public static NotificationOption2 Silent => new(ReportDiagnostic.Hidden, false); 30/// Notification option for a suggestion or an info option with <see cref="ReportDiagnostic.Info"/>. 32public static NotificationOption2 Suggestion => new(ReportDiagnostic.Info, false); 35/// Notification option for a warning option with <see cref="ReportDiagnostic.Warn"/>. 37public static NotificationOption2 Warning => new(ReportDiagnostic.Warn, false); 40/// Notification option for an error option with <see cref="ReportDiagnostic.Error"/>. 42public static NotificationOption2 Error => new(ReportDiagnostic.Error, false); 47public static NotificationOption2 ForSeverity(ReportDiagnostic reportDiagnostic) 50ReportDiagnostic.Error => Error, 51ReportDiagnostic.Warn => Warning, 52ReportDiagnostic.Info => Suggestion, 53ReportDiagnostic.Hidden or ReportDiagnostic.Default => Silent, 54ReportDiagnostic.Suppress => None,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\NamingStyles\NamingStyleOption.cs (1)
25EditorConfigOption<ReportDiagnostic> Severity)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (21)
34public static ReportDiagnostic GetEffectiveSeverity( 38ImmutableDictionary<string, ReportDiagnostic>? treeOptions) 40var effectiveSeverity = descriptor.GetEffectiveSeverity(compilationOptions); 45(!compilationOptions.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out var reportDiagnostic) || 46reportDiagnostic == ReportDiagnostic.Default)) 48if (treeOptions.TryGetValue(descriptor.Id, out reportDiagnostic) && reportDiagnostic != ReportDiagnostic.Default || 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default); 64public static ReportDiagnostic GetEffectiveSeverity(this DiagnosticDescriptor descriptor, CompilationOptions compilationOptions, SyntaxTree tree, AnalyzerOptions analyzerOptions) 66var effectiveSeverity = descriptor.GetEffectiveSeverity(compilationOptions); 70if (!compilationOptions.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out var reportDiagnostic) || 71reportDiagnostic == ReportDiagnostic.Default) 78var severityInEditorConfig = descriptor.GetEffectiveSeverity(analyzerConfigOptions, providerAndTree); 79if (severityInEditorConfig != ReportDiagnostic.Default) 86var severityInGlobalConfig = descriptor.GetEffectiveSeverity(analyzerOptions.AnalyzerConfigOptionsProvider.GlobalOptions, providerAndTree); 87if (severityInGlobalConfig != ReportDiagnostic.Default) 102EditorConfigSeverityStrings.TryParse(value, out var severity)) 145public static ReportDiagnostic GetEffectiveSeverity( 150ReportDiagnostic severity; 182return ReportDiagnostic.Default; 203return ReportDiagnostic.Default; 217out ReportDiagnostic severity)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticSeverityExtensions_Shared.cs (7)
13/// Returns the equivalent <see cref="ReportDiagnostic"/> for a <see cref="DiagnosticSeverity"/> value. 17/// The equivalent <see cref="ReportDiagnostic"/> for the <see cref="DiagnosticSeverity"/> value. 22public static ReportDiagnostic ToReportDiagnostic(this DiagnosticSeverity diagnosticSeverity) 25DiagnosticSeverity.Hidden => ReportDiagnostic.Hidden, 26DiagnosticSeverity.Info => ReportDiagnostic.Info, 27DiagnosticSeverity.Warning => ReportDiagnostic.Warn, 28DiagnosticSeverity.Error => ReportDiagnostic.Error,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ReportDiagnosticExtensions.cs (29)
14/// Returns the equivalent <see cref="DiagnosticSeverity"/> for a <see cref="ReportDiagnostic"/> value. 16/// <param name="reportDiagnostic">The <see cref="ReportDiagnostic"/> value.</param> 18/// The equivalent <see cref="DiagnosticSeverity"/> for a <see cref="ReportDiagnostic"/> value; otherwise, 25public static DiagnosticSeverity? ToDiagnosticSeverity(this ReportDiagnostic reportDiagnostic) 29case ReportDiagnostic.Error: 32case ReportDiagnostic.Warn: 35case ReportDiagnostic.Info: 38case ReportDiagnostic.Hidden: 41case ReportDiagnostic.Suppress: 42case ReportDiagnostic.Default: 51/// Applies a default severity to a <see cref="ReportDiagnostic"/> value. 53/// <param name="reportDiagnostic">The <see cref="ReportDiagnostic"/> value.</param> 56/// <para>If <paramref name="reportDiagnostic"/> is <see cref="ReportDiagnostic.Default"/>, returns 61public static ReportDiagnostic WithDefaultSeverity(this ReportDiagnostic reportDiagnostic, DiagnosticSeverity defaultSeverity) 63if (reportDiagnostic != ReportDiagnostic.Default) 71public static string ToEditorConfigString(this ReportDiagnostic reportDiagnostic) 75ReportDiagnostic.Suppress => EditorConfigSeverityStrings.None, 76ReportDiagnostic.Hidden => EditorConfigSeverityStrings.Silent, 77ReportDiagnostic.Info => EditorConfigSeverityStrings.Suggestion, 78ReportDiagnostic.Warn => EditorConfigSeverityStrings.Warning, 79ReportDiagnostic.Error => EditorConfigSeverityStrings.Error, 84public static NotificationOption2 ToNotificationOption(this ReportDiagnostic reportDiagnostic, DiagnosticSeverity defaultSeverity) 86var isNonDefault = reportDiagnostic != ReportDiagnostic.Default; 89ReportDiagnostic.Error => NotificationOption2.Error, 90ReportDiagnostic.Warn => NotificationOption2.Warning, 91ReportDiagnostic.Info => NotificationOption2.Suggestion, 92ReportDiagnostic.Hidden => NotificationOption2.Silent, 93ReportDiagnostic.Suppress => NotificationOption2.None,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
25var ruleNames = new Dictionary<(Guid symbolSpecificationID, Guid namingStyleID, ReportDiagnostic enforcementLevel), string>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_NamingRule.cs (12)
22if (!TryGetRuleSeverity(namingRuleTitle, conventionsDictionary, out var severity)) 41out (ReportDiagnostic severity, TextLine? line) value) 47out ReportDiagnostic severity) 64out (ReportDiagnostic severity, V value) value) 68var severity = ParseEnforcementLevel(valueSelector(result) ?? string.Empty); 77private static ReportDiagnostic ParseEnforcementLevel(string ruleSeverity) 82return ReportDiagnostic.Suppress; 86return ReportDiagnostic.Hidden; 88case EditorConfigSeverityStrings.Suggestion: return ReportDiagnostic.Info; 89case EditorConfigSeverityStrings.Warning: return ReportDiagnostic.Warn; 90case EditorConfigSeverityStrings.Error: return ReportDiagnostic.Error; 91default: return ReportDiagnostic.Hidden;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingRule.cs (2)
11internal readonly struct NamingRule(SymbolSpecification symbolSpecification, NamingStyle namingStyle, ReportDiagnostic enforcementLevel) 15public readonly ReportDiagnostic EnforcementLevel = enforcementLevel;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
24public ReportDiagnostic EnforcementLevel { get; init; }
Microsoft.CodeAnalysis.CodeStyle.Fixes (7)
src\Analyzers\Core\CodeFixes\Naming\FallbackNamingRules.cs (7)
33enforcementLevel: ReportDiagnostic.Hidden), 40enforcementLevel: ReportDiagnostic.Hidden), 44enforcementLevel: ReportDiagnostic.Hidden), 66ReportDiagnostic.Info); 75ReportDiagnostic.Info); 85ReportDiagnostic.Info); 94ReportDiagnostic.Info);
Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities (26)
src\Features\DiagnosticsTestUtilities\CodeActions\CSharpVerifierHelper.cs (5)
19/// related to nullability mapped to <see cref="ReportDiagnostic.Error"/>, which is then used to enable all 22internal static ImmutableDictionary<string, ReportDiagnostic> NullableWarnings { get; } = GetNullableWarningsFromCompiler(); 24private static ImmutableDictionary<string, ReportDiagnostic> GetNullableWarningsFromCompiler() 32.SetItem("CS8632", ReportDiagnostic.Error) 33.SetItem("CS8669", ReportDiagnostic.Error);
src\Features\DiagnosticsTestUtilities\NamingStyles\NamingStylesTestOptionSets.cs (21)
148EnforcementLevel = ReportDiagnostic.Error 179EnforcementLevel = ReportDiagnostic.Error 211EnforcementLevel = ReportDiagnostic.Error 243EnforcementLevel = ReportDiagnostic.Error 275EnforcementLevel = ReportDiagnostic.Error 313EnforcementLevel = ReportDiagnostic.Error 344EnforcementLevel = ReportDiagnostic.Error 375EnforcementLevel = ReportDiagnostic.Error 406EnforcementLevel = ReportDiagnostic.Error 437EnforcementLevel = ReportDiagnostic.Error 469EnforcementLevel = ReportDiagnostic.Error 501EnforcementLevel = ReportDiagnostic.Error 533EnforcementLevel = ReportDiagnostic.Error 565EnforcementLevel = ReportDiagnostic.Error 597EnforcementLevel = ReportDiagnostic.Error 629EnforcementLevel = ReportDiagnostic.Error 661EnforcementLevel = ReportDiagnostic.Error 695EnforcementLevel = ReportDiagnostic.Error 742EnforcementLevel = ReportDiagnostic.Error 749EnforcementLevel = ReportDiagnostic.Error 783EnforcementLevel = ReportDiagnostic.Error
Microsoft.CodeAnalysis.CSharp (104)
CommandLine\CSharpCommandLineParser.cs (20)
117var generalDiagnosticOption = ReportDiagnostic.Default; 118var diagnosticOptions = new Dictionary<string, ReportDiagnostic>(); 119var noWarns = new Dictionary<string, ReportDiagnostic>(); 120var warnAsErrors = new Dictionary<string, ReportDiagnostic>(); 245AddWarnings(noWarns, ReportDiagnostic.Suppress, valueMemory.Value); 884generalDiagnosticOption = ReportDiagnostic.Error; 891if (diagnosticOptions[key] == ReportDiagnostic.Warn) 893warnAsErrors[key] = ReportDiagnostic.Error; 906AddWarnings(warnAsErrors, ReportDiagnostic.Error, valueMemory.Value); 913generalDiagnosticOption = ReportDiagnostic.Default; 931ReportDiagnostic ruleSetValue; 938warnAsErrors[id] = ReportDiagnostic.Default; 2131private static void AddWarnings(Dictionary<string, ReportDiagnostic> d, ReportDiagnostic kind, ReadOnlyMemory<char> warningArgument) 2137ReportDiagnostic existing; 2141if (existing != ReportDiagnostic.Suppress) 2176private static void AddDiagnostic(IList<Diagnostic> diagnostics, Dictionary<string, ReportDiagnostic> warningOptions, ErrorCode errorCode, params object[] arguments) 2179ReportDiagnostic value; 2181if (value != ReportDiagnostic.Suppress)
Compilation\CSharpDiagnosticFilter.cs (42)
39ReportDiagnostic generalDiagnosticOption, 40IDictionary<string, ReportDiagnostic> specificDiagnosticOptions, 74ReportDiagnostic reportAction; 135internal static ReportDiagnostic GetDiagnosticReport( 145ReportDiagnostic generalDiagnosticOption, 146IDictionary<string, ReportDiagnostic> specificDiagnosticOptions, 175return ReportDiagnostic.Suppress; 182return ReportDiagnostic.Suppress; 185ReportDiagnostic report; 195if (report == ReportDiagnostic.Default) 216if (report == ReportDiagnostic.Warn && generalDiagnosticOption == ReportDiagnostic.Error && !specifiedWarnAsErrorMinus) 218report = ReportDiagnostic.Error; 231if ((tree != null && syntaxTreeOptions.TryGetDiagnosticValue(tree, id, cancellationToken, out var reportFromSyntaxTreeOptions) || 233!(specifiedWarnAsErrorMinus && severity == DiagnosticSeverity.Warning && reportFromSyntaxTreeOptions == ReportDiagnostic.Error)) 239if (!specifiedWarnAsErrorMinus && report == ReportDiagnostic.Warn && generalDiagnosticOption == ReportDiagnostic.Error) 241report = ReportDiagnostic.Error; 248report = isEnabledByDefault ? ReportDiagnostic.Default : ReportDiagnostic.Suppress; 251if (report == ReportDiagnostic.Suppress) 253return ReportDiagnostic.Suppress; 268case ReportDiagnostic.Error: 269case ReportDiagnostic.Hidden: 270case ReportDiagnostic.Info: 271case ReportDiagnostic.Warn: 275case ReportDiagnostic.Suppress: 277return ReportDiagnostic.Default; 279case ReportDiagnostic.Default: 280if (generalDiagnosticOption == ReportDiagnostic.Error && promoteToAnError()) 282return ReportDiagnostic.Error; 285return ReportDiagnostic.Default; 291else if (report == ReportDiagnostic.Suppress) // check options (/nowarn) 293return ReportDiagnostic.Suppress; 299if (report == ReportDiagnostic.Default) 303case ReportDiagnostic.Error: 306return ReportDiagnostic.Error; 309case ReportDiagnostic.Suppress: 315report = ReportDiagnostic.Suppress; 327report = ReportDiagnostic.Error; 334Debug.Assert(report == ReportDiagnostic.Default); 335Debug.Assert(generalDiagnosticOption == ReportDiagnostic.Error);
CSharpCompilationOptions.cs (22)
63ReportDiagnostic generalDiagnosticOption = ReportDiagnostic.Default, 65IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions = null, 113ReportDiagnostic generalDiagnosticOption, 115IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions, 158ReportDiagnostic generalDiagnosticOption, 160IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions, 200ReportDiagnostic generalDiagnosticOption, 202IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions, 443protected override CompilationOptions CommonWithGeneralDiagnosticOption(ReportDiagnostic value) => WithGeneralDiagnosticOption(value); 445protected override CompilationOptions CommonWithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>? specificDiagnosticOptions) => 448protected override CompilationOptions CommonWithSpecificDiagnosticOptions(IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions) => 454public new CSharpCompilationOptions WithGeneralDiagnosticOption(ReportDiagnostic value) 464public new CSharpCompilationOptions WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>? values) 468values = ImmutableDictionary<string, ReportDiagnostic>.Empty; 479public new CSharpCompilationOptions WithSpecificDiagnosticOptions(IEnumerable<KeyValuePair<string, ReportDiagnostic>>? values) => 829ReportDiagnostic generalDiagnosticOption, 831IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions, 868ReportDiagnostic generalDiagnosticOption, 870IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions, 912ReportDiagnostic generalDiagnosticOption, 914IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions,
Errors\MessageProvider.cs (1)
120public override ReportDiagnostic GetDiagnosticReport(DiagnosticInfo diagnosticInfo, CompilationOptions options)
Syntax\CSharpSyntaxTree.cs (6)
336ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions, 456ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions, 494ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions, 914ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions, 926ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions, 938ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions)
Syntax\CSharpSyntaxTree.Dummy.cs (1)
60public override ImmutableDictionary<string, ReportDiagnostic> DiagnosticOptions
Syntax\CSharpSyntaxTree.LazySyntaxTree.cs (4)
22private readonly ImmutableDictionary<string, ReportDiagnostic> _diagnosticOptions; 29ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions) 102public override ImmutableDictionary<string, ReportDiagnostic> DiagnosticOptions => _diagnosticOptions; 155public override SyntaxTree WithDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic> options)
Syntax\CSharpSyntaxTree.ParsedSyntaxTree.cs (4)
28private readonly ImmutableDictionary<string, ReportDiagnostic> _diagnosticOptions; 39ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions, 116public override ImmutableDictionary<string, ReportDiagnostic> DiagnosticOptions => _diagnosticOptions; 162public override SyntaxTree WithDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic> options)
Syntax\SyntaxFactory.cs (4)
2787ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions, 2800ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions, 2814ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions, 2828ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions,
Microsoft.CodeAnalysis.CSharp.CodeStyle (20)
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertNamespaceAnalysis.cs (2)
30var analyzerDisabled = option.Notification.Severity == ReportDiagnostic.Suppress; 60var analyzerDisabled = option.Notification.Severity == ReportDiagnostic.Suppress;
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
53var diagnosticLocation = severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) != ReportDiagnostic.Hidden
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
56var diagnosticLocation = option.Notification.Severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) != ReportDiagnostic.Hidden
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
47var analyzerDisabled = option.Notification.Severity == ReportDiagnostic.Suppress;
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (1)
20var analyzerDisabled = option.Notification.Severity == ReportDiagnostic.Suppress;
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToProgramMainDiagnosticAnalyzer.cs (1)
58root, isHidden: severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) == ReportDiagnostic.Hidden),
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
78methodDeclaration, isHidden: option.Notification.Severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) == ReportDiagnostic.Hidden),
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
102SymbolAnalysisContext context, ReportDiagnostic severity, PooledDictionary<IMethodSymbol, Diagnostic> methodToDiagnostic)
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (2)
95var analyzerDisabled = preference.Notification.Severity == ReportDiagnostic.Suppress; 181var analyzerDisabled = preference.Notification.Severity == ReportDiagnostic.Suppress;
src\Analyzers\CSharp\Analyzers\UseExpressionBody\UseExpressionBodyDiagnosticAnalyzer.cs (2)
100var location = severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) == ReportDiagnostic.Hidden 115var location = severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) == ReportDiagnostic.Hidden
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (4)
45var severity = UseExpressionBodyForLambdaHelpers.GetOptionSeverity(optionValue); 48case ReportDiagnostic.Error: 49case ReportDiagnostic.Warn: 50case ReportDiagnostic.Info:
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (2)
99internal static ReportDiagnostic GetOptionSeverity(CodeStyleOption2<ExpressionBodyPreference> optionValue) 102return severity == ReportDiagnostic.Default
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
139if (styleOption.Notification.Severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) < ReportDiagnostic.Hidden)
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (158)
CommandLineTests.cs (153)
306Assert.True(compilerTreeOptions.TryGetDiagnosticValue(tree, "cs0169", CancellationToken.None, out var severity)); 307Assert.Equal(ReportDiagnostic.Suppress, severity); 309Assert.Equal(ReportDiagnostic.Suppress, severity); 2841Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions["CA1012"] == ReportDiagnostic.Error); 2843Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions["CA1013"] == ReportDiagnostic.Warn); 2845Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions["CA1014"] == ReportDiagnostic.Suppress); 2846Assert.True(parsedArgs.CompilationOptions.GeneralDiagnosticOption == ReportDiagnostic.Warn); 3045Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Error); 3077Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Error); 3078Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Error); 3110Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Error); 3111Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Info); 3143Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Default); 3144Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Error); 3177Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Default); 3178Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Warn); 3211Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Error); 3212Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Warn); 3245Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Default); 3246Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Warn); 3247Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test002"], expected: ReportDiagnostic.Default); 3279Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption); 3281Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"]); 3314Assert.Equal(expected: ReportDiagnostic.Error, actual: arguments.CompilationOptions.GeneralDiagnosticOption); 3316Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"]); 3349Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption); 3351Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"]); 3373Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption); 3378Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions[warning]); 3381Assert.Equal(expected: ReportDiagnostic.Suppress, 3383Assert.Equal(expected: ReportDiagnostic.Suppress, 3406Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption); 3411Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions[warning]); 3414Assert.Equal(expected: ReportDiagnostic.Suppress, 3416Assert.Equal(expected: ReportDiagnostic.Suppress, 3439Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption); 3444Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions[warning]); 3447Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"]); 3448Assert.Equal(expected: ReportDiagnostic.Suppress, 3450Assert.Equal(expected: ReportDiagnostic.Suppress, 3473Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption); 3478Assert.Equal(expected: ReportDiagnostic.Error, actual: arguments.CompilationOptions.SpecificDiagnosticOptions[warning]); 3481Assert.Equal(expected: ReportDiagnostic.Error, 3483Assert.Equal(expected: ReportDiagnostic.Error, 5416private static void AssertSpecificDiagnostics(int[] expectedCodes, ReportDiagnostic[] expectedOptions, CSharpCommandLineArguments args) 5432Assert.Equal(ReportDiagnostic.Error, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5438Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5440AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Error }, parsedArgs); 5444Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5446AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Error }, parsedArgs); 5450Assert.Equal(ReportDiagnostic.Error, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5452AssertSpecificDiagnostics(new int[0], new ReportDiagnostic[0], parsedArgs); 5456Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5458AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Error }, parsedArgs); 5462Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5464AssertSpecificDiagnostics(new int[0], new ReportDiagnostic[0], parsedArgs); 5468Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5470AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Default, ReportDiagnostic.Default, ReportDiagnostic.Default }, parsedArgs); 5474Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5478new[] { ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Default, ReportDiagnostic.Default }, 5483Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5486AssertSpecificDiagnostics(new[] { 1062, 1066, 1734, 1974 }, new[] { ReportDiagnostic.Default, ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Default }, parsedArgs); 5490Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5492AssertSpecificDiagnostics(new[] { 1062, 1066, 1734, 1974 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Default, ReportDiagnostic.Default, ReportDiagnostic.Error }, parsedArgs); 5496Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5498AssertSpecificDiagnostics(new int[0], new ReportDiagnostic[0], parsedArgs); 5502Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5504AssertSpecificDiagnostics(new int[0], new ReportDiagnostic[0], parsedArgs); 5508Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5510AssertSpecificDiagnostics(new[] { 1062, 1974 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Error }, parsedArgs); 5514Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5516AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Suppress }, parsedArgs); 5520Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5522AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Suppress }, parsedArgs); 5526Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5528AssertSpecificDiagnostics(new[] { 1062, 1066, 1734, 1762 }, new[] { ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Error }, parsedArgs); 5532Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption); 5534AssertSpecificDiagnostics(new[] { 1062, 1066, 1734, 1762 }, new[] { ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Error }, parsedArgs); 13133TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Error); 13136TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress, noWarn: true); 13145TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn, rulesetText: rulesetText); 13152TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn); 13159TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn); 13166TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn); 13173TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn); 13179TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, warnAsError: true, expectedDiagnosticSeverity: ReportDiagnostic.Error); 13186TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress); 13193TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress); 13200TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText: string.Empty, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress); 13206TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress); 13212TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress); 13234var defaultReportDiagnostic = DiagnosticDescriptor.MapSeverityToReport(defaultSeverity); 13235var expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Error; 13242TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress, noWarn: true); 13251TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn, rulesetText: rulesetText); 13255expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Warn; 13272expectedDiagnosticSeverity = customConfigurable && defaultReportDiagnostic != ReportDiagnostic.Warn ? defaultReportDiagnostic : ReportDiagnostic.Error; 13281expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Suppress; 13292expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Suppress; 13298expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Suppress; 13324TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Error); 13331TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Error); 13339TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn); 13352TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn, rulesetText); 13359ReportDiagnostic expectedDiagnosticSeverity, 13404var expectedErrorCode = expectedDiagnosticSeverity == ReportDiagnostic.Error ? 1 : 0; 13409ReportDiagnostic.Error => "error", 13410ReportDiagnostic.Warn => "warning", 13411ReportDiagnostic.Info => errorlog ? "info" : null, 13412ReportDiagnostic.Hidden => null, 13413ReportDiagnostic.Suppress => null, 13592public void AnalyzerConfigRespectedForNoLocationDiagnostic(ReportDiagnostic reportDiagnostic, bool isEnabledByDefault, bool noWarn, bool errorlog) 13601public void AnalyzerConfigRespectedForDisabledByDefaultDiagnostic(ReportDiagnostic analyzerConfigSeverity, bool isEnabledByDefault, bool noWarn, bool errorlog, bool customConfigurable) 13607private void TestAnalyzerConfigRespectedCore(DiagnosticAnalyzer analyzer, DiagnosticDescriptor descriptor, ReportDiagnostic analyzerConfigSeverity, bool noWarn, bool errorlog, bool customConfigurable) 13609if (analyzerConfigSeverity == ReportDiagnostic.Default) 13649var expectedErrorCode = !noWarn && analyzerConfigSeverity == ReportDiagnostic.Error ? 1 : 0; 13654(analyzerConfigSeverity == ReportDiagnostic.Error || 13655analyzerConfigSeverity == ReportDiagnostic.Warn || 13656(analyzerConfigSeverity == ReportDiagnostic.Info && errorlog))) 13658var prefix = analyzerConfigSeverity == ReportDiagnostic.Error ? "error" : analyzerConfigSeverity == ReportDiagnostic.Warn ? "warning" : "info"; 15607var comp = CreateCompilation(src, options: TestOptions.DebugExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress));
SarifV2ErrorLoggerTests.cs (5)
377(AnalyzerForErrorLogTest.Descriptor1.Id, 0, ImmutableHashSet.Create(ReportDiagnostic.Error)))); 498(AnalyzerForErrorLogTest.Descriptor1.Id, 0, ImmutableHashSet.Create(ReportDiagnostic.Suppress)), 499(AnalyzerForErrorLogTest.Descriptor2.Id, 1, ImmutableHashSet.Create(ReportDiagnostic.Suppress)))); 580(AnalyzerForErrorLogTest.Descriptor1.Id, 0, ImmutableHashSet.Create(ReportDiagnostic.Suppress, ReportDiagnostic.Warn))));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (27)
Completion\CompletionProviders\DeclarationNameCompletionProviderTests.cs (1)
3032EnforcementLevel = ReportDiagnostic.Error
Diagnostics\NamingStyles\EditorConfigNamingStyleParserTests.cs (8)
45Assert.Equal(ReportDiagnostic.Warn, namingRule.EnforcementLevel); 90Assert.Equal(ReportDiagnostic.Warn, namingRule.EnforcementLevel); 115Assert.Equal(ReportDiagnostic.Error, namingRule.EnforcementLevel); 173Assert.Equal(ReportDiagnostic.Info, namingRule.EnforcementLevel); 221Assert.Equal(ReportDiagnostic.Hidden, namingRule.EnforcementLevel); 264Assert.Equal(ReportDiagnostic.Info, namingRule.EnforcementLevel); 307Assert.Equal(ReportDiagnostic.Info, namingRule.EnforcementLevel); 452Assert.Equal(ReportDiagnostic.Warn, namingRule.EnforcementLevel);
EditorConfigSettings\Updater\SettingsUpdaterTests.cs (17)
72private static async Task TestAsync(string initialEditorConfig, string updatedEditorConfig, params (AnalyzerSetting, ReportDiagnostic)[] options) 113[CombinatorialValues(ReportDiagnostic.Warn, ReportDiagnostic.Error, ReportDiagnostic.Info, ReportDiagnostic.Hidden, ReportDiagnostic.Suppress)] 114ReportDiagnostic severity) 134var analyzerSetting = new AnalyzerSetting(descriptor, ReportDiagnostic.Suppress, null!, language, new SettingLocation(EditorConfigSettings.LocationKind.VisualStudio, null)); 333var analyzerSetting = new AnalyzerSetting(descriptor, ReportDiagnostic.Suppress, updater, Language.CSharp, new SettingLocation(EditorConfigSettings.LocationKind.VisualStudio, null)); 334analyzerSetting.ChangeSeverity(ReportDiagnostic.Error); 357setting.ChangeSeverity(ReportDiagnostic.Error); 411setting0.ChangeSeverity(ReportDiagnostic.Error); 416Assert.Equal(ReportDiagnostic.Error, setting0.Severity); 418setting1.ChangeSeverity(ReportDiagnostic.Error); 419setting2.ChangeSeverity(ReportDiagnostic.Error); 424Assert.Equal(ReportDiagnostic.Error, setting0.Severity); 425Assert.Equal(ReportDiagnostic.Error, setting0.Severity);
Semantics\SpeculationAnalyzerTests.cs (1)
533TestOptions.ReleaseDll.WithSpecificDiagnosticOptions([KeyValuePairUtil.Create("CS0219", ReportDiagnostic.Suppress)]));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (9)
CodeGen\CodeGenTests.cs (1)
36.WithGeneralDiagnosticOption(ReportDiagnostic.Error);
Emit\CompilationEmitTests.cs (6)
4747var warnings = new System.Collections.Generic.Dictionary<string, ReportDiagnostic>(); 4748warnings.Add(MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_ALinkWarn), ReportDiagnostic.Suppress); 5571var options = TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error); 5579var options = TestOptions.DebugDll.WithSpecificDiagnosticOptions("CS0169", ReportDiagnostic.Error); 5616var options = TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error); 5624var options = TestOptions.DebugDll.WithSpecificDiagnosticOptions("CS0612", ReportDiagnostic.Error);
Emit\EmitErrorTests.cs (2)
304var warnOpts = new System.Collections.Generic.Dictionary<string, ReportDiagnostic>(); 305warnOpts.Add(MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_UnreferencedVarAssg), ReportDiagnostic.Suppress);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
PDB\CSharpDeterministicBuildCompilationTests.cs (1)
321generalDiagnosticOption: ReportDiagnostic.Default,
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (110)
Attributes\AttributeTests_Assembly.cs (6)
182var warnings = new Dictionary<string, ReportDiagnostic>(); 183warnings.Add(MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_ALinkWarn), ReportDiagnostic.Suppress); 214var warnings = new Dictionary<string, ReportDiagnostic>(); 215warnings.Add(MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_ALinkWarn), ReportDiagnostic.Suppress); 430var warnings = new Dictionary<string, ReportDiagnostic>(); 431warnings.Add(MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_ALinkWarn), ReportDiagnostic.Suppress);
Attributes\AttributeTests_WellKnownAttributes.cs (16)
8787verify(TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Warn), 8793verify(TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error), 8799verify(TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Hidden), 8804verify(TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)); 8807verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("TEST1", ReportDiagnostic.Warn)), 8813verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("TEST1", ReportDiagnostic.Error)), 8819verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("TEST1", ReportDiagnostic.Hidden)), 8825verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("TEST1", ReportDiagnostic.Suppress))); 8828verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("CS0618", ReportDiagnostic.Error)), 8834verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("CS0618", ReportDiagnostic.Suppress)),
Diagnostics\DiagnosticAnalyzerTests.cs (79)
145new[] { KeyValuePairUtil.Create("CA9999_UseOfVariableThatStartsWithX", ReportDiagnostic.Suppress) }); 168new[] { KeyValuePairUtil.Create("CA9999_UseOfVariableThatStartsWithX", ReportDiagnostic.Error) }); 200var options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error); 286var options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error); 316var specificDiagOptions = new Dictionary<string, ReportDiagnostic>(); 317specificDiagOptions.Add(noneDiagDescriptor.Id, ReportDiagnostic.Error); 318specificDiagOptions.Add(infoDiagDescriptor.Id, ReportDiagnostic.Error); 319specificDiagOptions.Add(warningDiagDescriptor.Id, ReportDiagnostic.Error); 331specificDiagOptions = new Dictionary<string, ReportDiagnostic>(); 332specificDiagOptions.Add(noneDiagDescriptor.Id, ReportDiagnostic.Suppress); 333specificDiagOptions.Add(infoDiagDescriptor.Id, ReportDiagnostic.Suppress); 334specificDiagOptions.Add(warningDiagDescriptor.Id, ReportDiagnostic.Suppress); 335specificDiagOptions.Add(errorDiagDescriptor.Id, ReportDiagnostic.Suppress); 343specificDiagOptions = new Dictionary<string, ReportDiagnostic>(); 344specificDiagOptions.Add(noneDiagDescriptor.Id, ReportDiagnostic.Info); 345specificDiagOptions.Add(infoDiagDescriptor.Id, ReportDiagnostic.Hidden); 346specificDiagOptions.Add(warningDiagDescriptor.Id, ReportDiagnostic.Error); 347specificDiagOptions.Add(errorDiagDescriptor.Id, ReportDiagnostic.Warn); 399var options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Default); 404options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error); 410options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Warn); 417options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Info); 424options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Hidden); 431options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress); 458var specificDiagOptions = new Dictionary<string, ReportDiagnostic>(); 459specificDiagOptions.Add(disabledDiagDescriptor.Id, ReportDiagnostic.Warn); 460specificDiagOptions.Add(enabledDiagDescriptor.Id, ReportDiagnostic.Suppress); 530var specificDiagOptions = new Dictionary<string, ReportDiagnostic>(); 531specificDiagOptions.Add(FullyDisabledAnalyzer.desc1.Id, ReportDiagnostic.Warn); 532specificDiagOptions.Add(PartiallyDisabledAnalyzer.desc2.Id, ReportDiagnostic.Suppress); 539specificDiagOptions = new Dictionary<string, ReportDiagnostic>(); 540specificDiagOptions.Add(FullyDisabledAnalyzer.desc3.Id, ReportDiagnostic.Warn); 1140var specificDiagOptions = new Dictionary<string, ReportDiagnostic>(); 1141specificDiagOptions.Add(NotConfigurableDiagnosticAnalyzer.EnabledRule.Id, ReportDiagnostic.Suppress); 1150specificDiagOptions.Add(NotConfigurableDiagnosticAnalyzer.DisabledRule.Id, ReportDiagnostic.Warn); 1277ReportDiagnostic expectedEffectiveSeverity, 1278Dictionary<string, ReportDiagnostic> specificOptions = null, 1279ReportDiagnostic generalOption = ReportDiagnostic.Default, 1282specificOptions = specificOptions ?? new Dictionary<string, ReportDiagnostic>(); 1285var effectiveSeverity = descriptor.GetEffectiveSeverity(options); 1294TestEffectiveSeverity(DiagnosticSeverity.Warning, ReportDiagnostic.Warn); 1302var specificOptions = new Dictionary<string, ReportDiagnostic>() { { "Test0001", ReportDiagnostic.Default } }; 1303var generalOption = ReportDiagnostic.Error; 1305TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity: ReportDiagnostic.Warn, specificOptions: specificOptions, generalOption: generalOption); 1313var generalOption = ReportDiagnostic.Error; 1322var specificOption = ReportDiagnostic.Suppress; 1323var specificOptions = new Dictionary<string, ReportDiagnostic>() { { "Test0001", specificOption } }; 1324var generalOption = ReportDiagnostic.Error; 1334var generalOption = ReportDiagnostic.Error; 1337TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity: ReportDiagnostic.Suppress, generalOption: generalOption, isEnabledByDefault: enabledByDefault); 1345var specificOption = ReportDiagnostic.Warn; 1346var specificOptions = new Dictionary<string, ReportDiagnostic>() { { "Test0001", specificOption } }; 1347var generalOption = ReportDiagnostic.Error; 1552var options = compilation.Options.WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1830if (compilation.Options.GeneralDiagnosticOption == ReportDiagnostic.Error) 3386new TestSyntaxTreeOptionsProvider(tree2, (NamedTypeAnalyzer.RuleId, ReportDiagnostic.Suppress))); 3429new TestSyntaxTreeOptionsProvider(tree2, (NamedTypeAnalyzer.RuleId, ReportDiagnostic.Suppress)) 3481new TestSyntaxTreeOptionsProvider(tree2, (NamedTypeAnalyzer.RuleId, ReportDiagnostic.Suppress)) 3533new TestSyntaxTreeOptionsProvider((NamedTypeAnalyzer.RuleId, ReportDiagnostic.Suppress))); 3554new TestSyntaxTreeOptionsProvider((NamedTypeAnalyzer.RuleId, ReportDiagnostic.Suppress), (tree1, new[] { (NamedTypeAnalyzer.RuleId, ReportDiagnostic.Default) }))); 4185new TestSyntaxTreeOptionsProvider(tree1, (AnalyzerWithDisabledRules.Rule.Id, ReportDiagnostic.Warn))); 4195.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add(AnalyzerWithDisabledRules.Rule.Id, ReportDiagnostic.Warn)) 4197(tree2, new[] { (AnalyzerWithDisabledRules.Rule.Id, ReportDiagnostic.Suppress) }), 4198(tree3, new[] { (AnalyzerWithDisabledRules.Rule.Id, ReportDiagnostic.Suppress) }))); 4271public override bool TryGetDiagnosticValue(SyntaxTree tree, string diagnosticId, CancellationToken cancellationToken, out ReportDiagnostic severity) 4274severity = ReportDiagnostic.Default; 4278public override bool TryGetGlobalDiagnosticValue(string diagnosticId, CancellationToken cancellationToken, out ReportDiagnostic severity) 4281severity = ReportDiagnostic.Default;
Diagnostics\DiagnosticSuppressorTests.cs (1)
313var specificDiagnosticOptions = compilation.Options.SpecificDiagnosticOptions.Add(suppressionId, ReportDiagnostic.Suppress);
FirstClassSpanTests.cs (4)
1909options: TestOptions.UnsafeReleaseExe.WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress), 2068options: TestOptions.UnsafeReleaseExe.WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress)); 2306options: TestOptions.UnsafeReleaseExe.WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress)); 2539options: TestOptions.UnsafeReleaseExe.WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress));
Semantics\CollectionExpressionTests.cs (3)
26private static readonly IEnumerable<KeyValuePair<string, ReportDiagnostic>> WithSpanAllocWarning = new[] 28KeyValuePairUtil.Create(GetIdForErrorCode(ErrorCode.WRN_CollectionExpressionRefStructMayAllocate), ReportDiagnostic.Warn), 29KeyValuePairUtil.Create(GetIdForErrorCode(ErrorCode.WRN_CollectionExpressionRefStructSpreadMayAllocate), ReportDiagnostic.Warn)
Semantics\RecordTests.cs (1)
30193var compB = CreateCompilation(sourceB, references: new[] { refA }, options: TestOptions.ReleaseDll.WithSpecificDiagnosticOptions("CS1701", ReportDiagnostic.Suppress), parseOptions: TestOptions.Regular9, targetFramework: TargetFramework.NetCoreApp);
Microsoft.CodeAnalysis.CSharp.Features (29)
CodeRefactorings\UseExplicitOrImplicitType\AbstractUseTypeCodeRefactoringProvider.cs (1)
52if (typeStyle.IsStylePreferred && typeStyle.Notification.Severity != ReportDiagnostic.Suppress)
ConvertProgram\ConvertToProgramMainCodeFixProvider.cs (1)
41var priority = options.PreferTopLevelStatements.Notification.Severity == ReportDiagnostic.Hidden
ConvertProgram\ConvertToTopLevelStatementsCodeFixProvider.cs (1)
41var priority = options.PreferTopLevelStatements.Notification.Severity == ReportDiagnostic.Hidden
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertNamespaceAnalysis.cs (2)
30var analyzerDisabled = option.Notification.Severity == ReportDiagnostic.Suppress; 60var analyzerDisabled = option.Notification.Severity == ReportDiagnostic.Suppress;
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
53var diagnosticLocation = severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) != ReportDiagnostic.Hidden
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
56var diagnosticLocation = option.Notification.Severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) != ReportDiagnostic.Hidden
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
47var analyzerDisabled = option.Notification.Severity == ReportDiagnostic.Suppress;
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (1)
20var analyzerDisabled = option.Notification.Severity == ReportDiagnostic.Suppress;
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToProgramMainDiagnosticAnalyzer.cs (1)
58root, isHidden: severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) == ReportDiagnostic.Hidden),
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
78methodDeclaration, isHidden: option.Notification.Severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) == ReportDiagnostic.Hidden),
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
102SymbolAnalysisContext context, ReportDiagnostic severity, PooledDictionary<IMethodSymbol, Diagnostic> methodToDiagnostic)
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (2)
95var analyzerDisabled = preference.Notification.Severity == ReportDiagnostic.Suppress; 181var analyzerDisabled = preference.Notification.Severity == ReportDiagnostic.Suppress;
src\Analyzers\CSharp\Analyzers\UseExpressionBody\UseExpressionBodyDiagnosticAnalyzer.cs (2)
100var location = severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) == ReportDiagnostic.Hidden 115var location = severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) == ReportDiagnostic.Hidden
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (4)
45var severity = UseExpressionBodyForLambdaHelpers.GetOptionSeverity(optionValue); 48case ReportDiagnostic.Error: 49case ReportDiagnostic.Warn: 50case ReportDiagnostic.Info:
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (2)
99internal static ReportDiagnostic GetOptionSeverity(CodeStyleOption2<ExpressionBodyPreference> optionValue) 102return severity == ReportDiagnostic.Default
src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (1)
139if (styleOption.Notification.Severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) < ReportDiagnostic.Hidden)
UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeRefactoringProvider.cs (6)
37var severity = UseExpressionBodyForLambdaHelpers.GetOptionSeverity(optionValue); 40case ReportDiagnostic.Suppress: 41case ReportDiagnostic.Hidden: 51case ReportDiagnostic.Error: 52case ReportDiagnostic.Warn: 53case ReportDiagnostic.Info:
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (8)
ConvertAutoPropertyToFullProperty\ConvertAutoPropertyToFullPropertyTests_OptionSets.cs (3)
94EnforcementLevel = ReportDiagnostic.Error 126EnforcementLevel = ReportDiagnostic.Error 158EnforcementLevel = ReportDiagnostic.Error
ConvertTupleToStruct\ConvertTupleToStructTests.cs (1)
403EnforcementLevel = ReportDiagnostic.Error
Diagnostics\Suppression\RemoveUnnecessaryPragmaSuppressionsTests.cs (2)
1063ImmutableDictionary<string, ReportDiagnostic>.Empty 1064.Add(IDEDiagnosticIds.RemoveUnnecessarySuppressionDiagnosticId, ReportDiagnostic.Suppress));
Diagnostics\Suppression\SuppressionTests.cs (2)
760var specificDiagnosticOptions = new[] { KeyValuePairUtil.Create(IDEDiagnosticIds.FormattingDiagnosticId, ReportDiagnostic.Warn) }; 1002var specificDiagnosticOptions = new[] { KeyValuePairUtil.Create(IDEDiagnosticIds.FormattingDiagnosticId, ReportDiagnostic.Warn) };
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (117)
Semantics\InitOnlyMemberTests.cs (4)
3469ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("CS1685", ReportDiagnostic.Suppress))); 3568ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("CS1685", ReportDiagnostic.Suppress)));
Semantics\NullableReferenceTypesTests.cs (102)
6364var comp2 = CreateCompilation(source, options: TestOptions.DebugDll.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress)); 125110foreach (ReportDiagnostic option in Enum.GetValues(typeof(ReportDiagnostic))) 125135comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default)); 125144comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithGeneralDiagnosticOption(ReportDiagnostic.Default)); 125154WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default). 125155WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 125164comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error)); 125174WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error). 125175WithGeneralDiagnosticOption(ReportDiagnostic.Default)); 125185WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 125195WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress)); 125200WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress). 125201WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 125206WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)); 125210comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden)); 125220WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden). 125221WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 125231WithGeneralDiagnosticOption(ReportDiagnostic.Hidden)); 125241WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default). 125242WithGeneralDiagnosticOption(ReportDiagnostic.Hidden)); 125293foreach (ReportDiagnostic option in Enum.GetValues(typeof(ReportDiagnostic))) 125314comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Default)); 125317comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithGeneralDiagnosticOption(ReportDiagnostic.Default)); 125321WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Default). 125322WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 125325comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Error)); 125329WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Error). 125330WithGeneralDiagnosticOption(ReportDiagnostic.Default)); 125334WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 125338WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Suppress)); 125342WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Suppress). 125343WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 125347WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)); 125350comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Hidden)); 125354WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Hidden). 125355WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 125359WithGeneralDiagnosticOption(ReportDiagnostic.Hidden)); 125363WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Default). 125364WithGeneralDiagnosticOption(ReportDiagnostic.Hidden)); 125470comp = CreateCompilation(new[] { source, source2 }, options: options.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default)); 125479comp = CreateCompilation(new[] { source, source2 }, options: options.WithGeneralDiagnosticOption(ReportDiagnostic.Default)); 125489WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default). 125490WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 125499comp = CreateCompilation(new[] { source, source2 }, options: options.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error)); 125509WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error). 125510WithGeneralDiagnosticOption(ReportDiagnostic.Default)); 125520WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 125530WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress)); 125535WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress). 125536WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 125541WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)); 125545comp = CreateCompilation(new[] { source, source2 }, options: options.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden)); 125555WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden). 125556WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 125566WithGeneralDiagnosticOption(ReportDiagnostic.Hidden)); 125576WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default). 125577WithGeneralDiagnosticOption(ReportDiagnostic.Hidden)); 126004comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default)); 126008comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithGeneralDiagnosticOption(ReportDiagnostic.Default)); 126013WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default). 126014WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 126018comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error)); 126023WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error). 126024WithGeneralDiagnosticOption(ReportDiagnostic.Default)); 126029WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 126034WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress)); 126039WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress). 126040WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 126045WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)); 126049comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden)); 126054WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden). 126055WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 126060WithGeneralDiagnosticOption(ReportDiagnostic.Hidden)); 126065WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default). 126066WithGeneralDiagnosticOption(ReportDiagnostic.Hidden)); 126078foreach (ReportDiagnostic option in Enum.GetValues(typeof(ReportDiagnostic))) 126150comp = CreateCompilation(new[] { source, source2 }, options: options.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default)); 126154comp = CreateCompilation(new[] { source, source2 }, options: options.WithGeneralDiagnosticOption(ReportDiagnostic.Default)); 126159WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default). 126160WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 126164comp = CreateCompilation(new[] { source, source2 }, options: options.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error)); 126169WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error). 126170WithGeneralDiagnosticOption(ReportDiagnostic.Default)); 126175WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 126180WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress)); 126185WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress). 126186WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 126191WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)); 126195comp = CreateCompilation(new[] { source, source2 }, options: options.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden)); 126200WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden). 126201WithGeneralDiagnosticOption(ReportDiagnostic.Error)); 126206WithGeneralDiagnosticOption(ReportDiagnostic.Hidden)); 126211WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default). 126212WithGeneralDiagnosticOption(ReportDiagnostic.Hidden)); 144986options: WithNullableEnable().WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress)); 144999options: WithNullableEnable().WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress)); 145056", options: WithNullableEnable().WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress)); 145074", options: WithNullableEnable().WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress)); 145128", options: WithNullableEnable().WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress));
Semantics\SemanticErrorTests.cs (5)
2115var comp = CreateCompilation(text, options: TestOptions.ReleaseDll.WithSpecificDiagnosticOptions(new Dictionary<string, ReportDiagnostic>() 2117{ MessageProvider.Instance.GetIdForErrorCode(649), ReportDiagnostic.Suppress } 11037var noWarns = new Dictionary<string, ReportDiagnostic>(); 11038noWarns.Add(MessageProvider.Instance.GetIdForErrorCode(219), ReportDiagnostic.Suppress); 23620CreateCompilation(builder.ToString(), null, TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)).VerifyEmitDiagnostics(
Semantics\StructConstructorTests.cs (1)
3901CreateCompilation(source, options: TestOptions.DebugDll.WithSpecificDiagnosticOptions(GetIdForErrorCode(ErrorCode.WRN_UnassignedThisSupportedVersion), ReportDiagnostic.Error), parseOptions: TestOptions.Regular11)
Semantics\UninitializedNonNullableFieldTests.cs (1)
2785options = options.WithGeneralDiagnosticOption(ReportDiagnostic.Error);
SourceGeneration\GeneratorDriverTests.cs (4)
1176verifyDiagnosticsWithOptions(options.WithSpecificDiagnosticOptions("GEN001", ReportDiagnostic.Suppress), 1179verifyDiagnosticsWithOptions(options.WithSpecificDiagnosticOptions("GEN002", ReportDiagnostic.Suppress), 1193verifyDiagnosticsWithOptions(options.WithSpecificDiagnosticOptions("GEN001", ReportDiagnostic.Error), 1197verifyDiagnosticsWithOptions(options.WithSpecificDiagnosticOptions("GEN002", ReportDiagnostic.Error),
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (39)
Compilation\CompilationAPITests.cs (12)
39params (string, ReportDiagnostic)[] options) 53diagnosticOptions: CreateImmutableDictionary(("CS1584", ReportDiagnostic.Suppress)), 72.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress); 77new TestSyntaxTreeOptionsProvider((tree, new[] { ("CS0078", ReportDiagnostic.Warn) }))); 101var options = WithDiagnosticOptions(tree, ("CS0078", ReportDiagnostic.Suppress)); 126var options = WithDiagnosticOptions(tree, ("CS0078", ReportDiagnostic.Error)); 139var options = WithDiagnosticOptions(tree, ("CS0078", ReportDiagnostic.Suppress)); 149CreateImmutableDictionary(("CS0078", ReportDiagnostic.Error))); 169(tree, new[] { ("CS0078", ReportDiagnostic.Suppress) }), 170(newTree, new[] { ("CS0078", ReportDiagnostic.Error) }) 195new TestSyntaxTreeOptionsProvider((tree, new[] { ("cs0078", ReportDiagnostic.Suppress) })) 208(tree, new[] { ("cs0078", ReportDiagnostic.Suppress) }))
Compilation\CSharpCompilationOptionsTests.cs (17)
84TestHiddenProperty((old, value) => old.WithGeneralDiagnosticOption(value), opt => opt.GeneralDiagnosticOption, ReportDiagnostic.Suppress); 87new Dictionary<string, ReportDiagnostic> { { "CS0001", ReportDiagnostic.Error } }.ToImmutableDictionary()); 122TestProperty((old, value) => old.WithGeneralDiagnosticOption(value), opt => opt.GeneralDiagnosticOption, ReportDiagnostic.Suppress); 126new Dictionary<string, ReportDiagnostic> { { "CS0001", ReportDiagnostic.Error } }.ToImmutableDictionary()); 193Assert.Equal(ReportDiagnostic.Default, defaultWarnings.GeneralDiagnosticOption); 196Assert.Equal(ReportDiagnostic.Error, new CSharpCompilationOptions(OutputKind.ConsoleApplication).WithGeneralDiagnosticOption(ReportDiagnostic.Error).GeneralDiagnosticOption); 197Assert.Equal(ReportDiagnostic.Default, new CSharpCompilationOptions(OutputKind.ConsoleApplication).WithGeneralDiagnosticOption(ReportDiagnostic.Default).GeneralDiagnosticOption); 228var warnings = new Dictionary<string, ReportDiagnostic> 230{ MessageProvider.Instance.GetIdForErrorCode(1), ReportDiagnostic.Error }, 231{ MessageProvider.Instance.GetIdForErrorCode(2), ReportDiagnostic.Suppress }, 232{ MessageProvider.Instance.GetIdForErrorCode(3), ReportDiagnostic.Warn } 397ReportDiagnostic generalDiagnosticOption = 0; 399IEnumerable<KeyValuePair<string, ReportDiagnostic>> specificDiagnosticOptions = null;
Compilation\GetUnusedImportDirectivesTests.cs (1)
379var comp = CreateCompilation(source, options: TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error));
Compilation\UsedAssembliesTests.cs (1)
295options = options.WithSpecificDiagnosticOptions(options.SpecificDiagnosticOptions.Add("CS1591", ReportDiagnostic.Suppress));
DeclarationTests.cs (1)
994public override ImmutableDictionary<string, ReportDiagnostic> DiagnosticOptions => throw new NotImplementedException();
DocumentationComments\DocumentationCommentCompilerTests.cs (3)
5759var warnDict = new Dictionary<string, ReportDiagnostic> { { MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_MissingXMLComment), ReportDiagnostic.Suppress } }; 7116var compOptions = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error);
Symbols\CovariantReturnTests.cs (1)
515options: TestOptions.ReleaseDll.WithSpecificDiagnosticOptions("CS1701", ReportDiagnostic.Suppress),
Symbols\GenericConstraintTests.cs (1)
7312comp.WithOptions(comp.Options.WithSpecificDiagnosticOptions("CS1701", ReportDiagnostic.Suppress)),
Symbols\SymbolErrorTests.cs (2)
108options: TestOptions.ReleaseDll.WithSpecificDiagnosticOptions(new Dictionary<string, ReportDiagnostic>() { { MessageProvider.Instance.GetIdForErrorCode((int)ErrorCode.WRN_UnreferencedField), ReportDiagnostic.Suppress } }),
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (105)
Diagnostics\DiagnosticTest.cs (97)
569IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 570warnings.Add(MessageProvider.Instance.GetIdForErrorCode(420), ReportDiagnostic.Suppress); 574option = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error); 580warnings[MessageProvider.Instance.GetIdForErrorCode(420)] = ReportDiagnostic.Error; 581option = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Default).WithSpecificDiagnosticOptions(warnings); 613IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 614warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Suppress); 621warnings[MessageProvider.Instance.GetIdForErrorCode(168)] = ReportDiagnostic.Error; 643option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 673IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 674warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 690option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 724IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 725warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 747option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 780IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 781warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 803option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 836IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 837warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 859option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 894IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 895warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 917option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 952IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 953warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 975option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1011IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1012warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1040option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1081IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1082warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1116option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1152IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1153warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1181option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1217IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1218warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1234option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1270IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1271warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1287option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1324IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1325warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1341option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1374IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1375warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1385option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1425var warnings = new Dictionary<string, ReportDiagnostic>(); 1426warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1442option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error); 1481IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1482warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1498warnings = new Dictionary<string, ReportDiagnostic>(); 1499warnings.Add(MessageProvider.Instance.GetIdForErrorCode(1633), ReportDiagnostic.Suppress); 1548IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1549warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1598IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1599warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1654IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1655warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1701IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1702warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1738IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1739warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1771IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>(); 1772warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1782warnings[MessageProvider.Instance.GetIdForErrorCode(168)] = ReportDiagnostic.Suppress; 1820var warnings = new Dictionary<string, ReportDiagnostic>(); 1821warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 1834warnings[MessageProvider.Instance.GetIdForErrorCode(168)] = ReportDiagnostic.Suppress; 2143var options = TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress); 2244var warnings = new Dictionary<string, ReportDiagnostic>(); 2245warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error); 2264warnings[MessageProvider.Instance.GetIdForErrorCode(168)] = ReportDiagnostic.Suppress;
Syntax\SyntaxTreeTests.cs (8)
130var options = CreateImmutableDictionary(("CS0078", ReportDiagnostic.Suppress)); 140var options = CreateImmutableDictionary(("CS0078", ReportDiagnostic.Suppress)); 166Assert.NotSame(ImmutableDictionary<string, ReportDiagnostic>.Empty, tree.DiagnosticOptions); 176diagnosticOptions: ImmutableDictionary<string, ReportDiagnostic>.Empty, 181Assert.Same(ImmutableDictionary<string, ReportDiagnostic>.Empty, tree.DiagnosticOptions); 187var options = CreateImmutableDictionary(("CS0078", ReportDiagnostic.Suppress)); 220var newTree = tree.WithDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty); 232new[] { KeyValuePair.Create("CS00778", ReportDiagnostic.Suppress) });
Microsoft.CodeAnalysis.CSharp.Test.Utilities (10)
CSharpTestBase.cs (6)
2380internal static ImmutableDictionary<string, ReportDiagnostic> ReportStructInitializationWarnings { get; } = ImmutableDictionary.CreateRange( 2383KeyValuePairUtil.Create(GetIdForErrorCode(ErrorCode.WRN_UseDefViolationPropertySupportedVersion), ReportDiagnostic.Warn), 2384KeyValuePairUtil.Create(GetIdForErrorCode(ErrorCode.WRN_UseDefViolationFieldSupportedVersion), ReportDiagnostic.Warn), 2385KeyValuePairUtil.Create(GetIdForErrorCode(ErrorCode.WRN_UseDefViolationThisSupportedVersion), ReportDiagnostic.Warn), 2386KeyValuePairUtil.Create(GetIdForErrorCode(ErrorCode.WRN_UnassignedThisAutoPropertySupportedVersion), ReportDiagnostic.Warn), 2387KeyValuePairUtil.Create(GetIdForErrorCode(ErrorCode.WRN_UnassignedThisSupportedVersion), ReportDiagnostic.Warn),
TestOptions.cs (4)
172public static CSharpCompilationOptions WithSpecificDiagnosticOptions(this CSharpCompilationOptions options, string key, ReportDiagnostic value) 174return options.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add(key, value)); 177public static CSharpCompilationOptions WithSpecificDiagnosticOptions(this CSharpCompilationOptions options, string key1, string key2, ReportDiagnostic value) 179return options.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add(key1, value).Add(key2, value));
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (12)
CodeStyle\CSharpEditorConfigCodeStyleParserTests.cs (12)
43[InlineData("false:none", (int)ExpressionBodyPreference.Never, ReportDiagnostic.Suppress)] 44[InlineData("true:warning", (int)ExpressionBodyPreference.WhenPossible, ReportDiagnostic.Warn)] 45[InlineData("when_on_single_line:error", (int)ExpressionBodyPreference.WhenOnSingleLine, ReportDiagnostic.Error)] 48[InlineData("false : none", (int)ExpressionBodyPreference.Never, ReportDiagnostic.Suppress)] 49[InlineData("true : warning", (int)ExpressionBodyPreference.WhenPossible, ReportDiagnostic.Warn)] 50[InlineData("when_on_single_line : error", (int)ExpressionBodyPreference.WhenOnSingleLine, ReportDiagnostic.Error)] 55public void TestParseExpressionBodyPreference(string optionString, int parsedValue, ReportDiagnostic? severity) 58severity ??= ReportDiagnostic.Error; 67[InlineData("inside_namespace:warning", AddImportPlacement.InsideNamespace, ReportDiagnostic.Warn)] 68[InlineData("outside_namespace:suggestion", AddImportPlacement.OutsideNamespace, ReportDiagnostic.Info)] 71internal void TestParseUsingDirectivesPlacement(string optionString, AddImportPlacement parsedValue, ReportDiagnostic? severity) 74severity ??= ReportDiagnostic.Error;
Microsoft.CodeAnalysis.EditorFeatures (27)
EditorConfigSettings\Data\AnalyzerSetting.cs (5)
20ReportDiagnostic effectiveSeverity, 27if (effectiveSeverity == ReportDiagnostic.Default) 32var enabled = effectiveSeverity != ReportDiagnostic.Suppress; 44public ReportDiagnostic Severity { get; private set; } 50internal void ChangeSeverity(ReportDiagnostic severity)
EditorConfigSettings\Data\CodeStyleSetting.cs (9)
18public ReportDiagnostic GetSeverity() 21if (severity is ReportDiagnostic.Default or ReportDiagnostic.Suppress) 22severity = ReportDiagnostic.Hidden; 34public void ChangeSeverity(ReportDiagnostic severity) 38ReportDiagnostic.Hidden => NotificationOption2.Silent, 39ReportDiagnostic.Info => NotificationOption2.Suggestion, 40ReportDiagnostic.Warn => NotificationOption2.Warning, 41ReportDiagnostic.Error => NotificationOption2.Error,
EditorConfigSettings\Data\NamingStyleSetting.cs (3)
57public ReportDiagnostic Severity { get; private set; } 62if (setting is (ReportDiagnostic severity, _)) 76internal void ChangeSeverity(ReportDiagnostic severity)
EditorConfigSettings\DataProvider\Analyzer\AnalyzerSettingsProvider.cs (1)
18internal sealed class AnalyzerSettingsProvider : SettingsProviderBase<AnalyzerSetting, AnalyzerSettingsUpdater, AnalyzerSetting, ReportDiagnostic>
EditorConfigSettings\Updater\AnalyzerSettingsUpdater.cs (2)
12internal class AnalyzerSettingsUpdater(Workspace workspace, string editorconfigPath) : SettingsUpdaterBase<AnalyzerSetting, ReportDiagnostic>(workspace, editorconfigPath) 15IReadOnlyList<(AnalyzerSetting option, ReportDiagnostic value)> settingsToUpdate,
EditorConfigSettings\Updater\NamingStyles\NamingStyleSettingsUpdater.cs (1)
44if (value is ReportDiagnostic enforcement)
EditorConfigSettings\Updater\SettingsUpdateHelper.cs (6)
26IReadOnlyList<(AnalyzerSetting option, ReportDiagnostic value)> settingsToUpdate) 37static (string option, string value, Language language) GetOptionValueAndLanguage(AnalyzerSetting diagnostic, ReportDiagnostic severity) 69ReportDiagnostic.Hidden => "silent", 70ReportDiagnostic.Info => "suggestion", 71ReportDiagnostic.Warn => "warning", 72ReportDiagnostic.Error => "error",
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Diagnostics\DiagnosticAnalyzerServiceTests.cs (1)
341var newSpecificOptions = project.CompilationOptions.SpecificDiagnosticOptions.Add(NamedTypeAnalyzer.DiagnosticId, ReportDiagnostic.Warn);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (4)
Diagnostics\DiagnosticServiceTests.vb (4)
297Dim suppressDiagOptions = New Dictionary(Of String, ReportDiagnostic) 298suppressDiagOptions.Add(workspaceDiagnosticAnalyzer.DiagDescriptor.Id, ReportDiagnostic.Suppress) 305Dim changeSeverityDiagOptions = New Dictionary(Of String, ReportDiagnostic) 306changeSeverityDiagOptions.Add(workspaceDiagnosticAnalyzer.DiagDescriptor.Id, ReportDiagnostic.Error)
Microsoft.CodeAnalysis.Features (36)
CodeFixes\Configuration\ConfigurationUpdater.cs (2)
108ReportDiagnostic severity, 113if (severity == ReportDiagnostic.Default)
Diagnostics\DiagnosticAnalyzerExtensions.cs (1)
27public static ReportDiagnostic GetEffectiveSeverity(this DiagnosticDescriptor descriptor, CompilationOptions options)
PreferFrameworkType\PreferFrameworkTypeDiagnosticAnalyzerBase.cs (1)
109=> !optionValue.Value && optionValue.Notification.Severity != ReportDiagnostic.Suppress;
src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs (3)
163if (notification?.Severity == ReportDiagnostic.Suppress) 211if (severityOptionsProvider.TryGetDiagnosticValue(tree, descriptor.Id, cancellationToken, out var configuredReportDiagnostic) 246if (EditorConfigSeverityStrings.TryParse(editorConfigSeverity!, out var effectiveReportDiagnostic)
src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (3)
269var effectiveSeverity = notificationOption.Severity; 277warningLevel: effectiveSeverity.WithDefaultSeverity(descriptor.DefaultSeverity) == ReportDiagnostic.Error ? 0 : 1, 278effectiveSeverity == ReportDiagnostic.Suppress,
src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (1)
142applicableRule.EnforcementLevel == ReportDiagnostic.Suppress)
src\Analyzers\Core\Analyzers\OrderModifiers\AbstractOrderModifiersDiagnosticAnalyzer.cs (1)
75if (notificationOption.Severity.WithDefaultSeverity(DiagnosticSeverity.Hidden) == ReportDiagnostic.Hidden)
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (3)
136var effectiveSeverity = _classificationIdDescriptor.GetEffectiveSeverity(compilation.Options, tree, context.Options); 137if (effectiveSeverity is ReportDiagnostic.Warn or ReportDiagnostic.Error)
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
104compilationWithAnalyzers.Compilation.Options.SyntaxTreeOptionsProvider.TryGetDiagnosticValue(tree, IDEDiagnosticIds.RemoveUnnecessarySuppressionDiagnosticId, cancellationToken, out var severity) || 107if (severity == ReportDiagnostic.Suppress)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (6)
226option.Notification.Severity == ReportDiagnostic.Suppress) 256Debug.Assert(unusedValueExpressionStatementSeverity.Severity != ReportDiagnostic.Suppress || 257unusedValueAssignmentSeverity.Severity != ReportDiagnostic.Suppress || 258unusedParametersSeverity.Severity != ReportDiagnostic.Suppress); 279ReportDiagnostic unusedParametersSeverity) 281if (unusedParametersSeverity == ReportDiagnostic.Suppress)
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (3)
164if (_options.UnusedValueExpressionStatementNotification.Severity == ReportDiagnostic.Suppress) 457if (_options.UnusedValueAssignmentSeverity.Severity == ReportDiagnostic.Suppress && 604if (_options.UnusedValueAssignmentSeverity.Severity == ReportDiagnostic.Suppress ||
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (1)
134if (option.Notification.Severity == ReportDiagnostic.Suppress ||
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
384if (notification.Severity == ReportDiagnostic.Suppress)
src\Analyzers\Core\Analyzers\UseExplicitTupleName\UseExplicitTupleNameDiagnosticAnalyzer.cs (1)
42if (option.Notification.Severity == ReportDiagnostic.Suppress)
src\Analyzers\Core\CodeFixes\Naming\FallbackNamingRules.cs (7)
33enforcementLevel: ReportDiagnostic.Hidden), 40enforcementLevel: ReportDiagnostic.Hidden), 44enforcementLevel: ReportDiagnostic.Hidden), 66ReportDiagnostic.Info); 75ReportDiagnostic.Info); 85ReportDiagnostic.Info); 94ReportDiagnostic.Info);
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs (1)
147return descriptors.Any(static (d, arg) => d.GetEffectiveSeverity(arg.CompilationOptions, arg.isHostAnalyzer ? arg.analyzerConfigOptions?.ConfigOptionsWithFallback : arg.analyzerConfigOptions?.ConfigOptionsWithoutFallback, arg.analyzerConfigOptions?.TreeOptions) != ReportDiagnostic.Hidden, (project.CompilationOptions, isHostAnalyzer, analyzerConfigOptions));
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
Diagnostics\PullDiagnosticTests.cs (1)
1805projectInfo = projectInfo.WithCompilationOptions(projectInfo.CompilationOptions!.WithGeneralDiagnosticOption(ReportDiagnostic.Error));
Microsoft.CodeAnalysis.Rebuild (2)
CSharpCompilationFactory.cs (1)
104ReportDiagnostic.Suppress,
VisualBasicCompilationFactory.cs (1)
115generalDiagnosticOption: ReportDiagnostic.Default,
Microsoft.CodeAnalysis.Rebuild.UnitTests (4)
DeterministicKeyBuilderTests.cs (4)
388]", ("CA109", ReportDiagnostic.Error)); 398]", ("CA109", ReportDiagnostic.Error), ("CA200", ReportDiagnostic.Warn)); 400void assert(string expected, params (string Diagnostic, ReportDiagnostic ReportDiagnostic)[] values)
Microsoft.CodeAnalysis.Test.Utilities (33)
Compilation\TestSyntaxTreeOptionsProvider.cs (13)
15private readonly Dictionary<SyntaxTree, Dictionary<string, ReportDiagnostic>>? _options; 17private readonly Dictionary<string, ReportDiagnostic>? _globalOptions; 20(string? key, ReportDiagnostic diagnostic) globalOption, 21params (SyntaxTree, (string, ReportDiagnostic)[])[] options) 32_globalOptions = new Dictionary<string, ReportDiagnostic>(Section.PropertiesKeyComparer) { { globalOption.key, globalOption.diagnostic } }; 38params (SyntaxTree, (string, ReportDiagnostic)[])[] options) 43(string, ReportDiagnostic) globalOption, 44params (SyntaxTree, (string, ReportDiagnostic)[])[] options) 49SyntaxTree tree, params (string, ReportDiagnostic)[] options) 71out ReportDiagnostic severity) 79severity = ReportDiagnostic.Default; 83public override bool TryGetGlobalDiagnosticValue(string diagnosticId, CancellationToken cancellationToken, out ReportDiagnostic severity) 90severity = ReportDiagnostic.Default;
Diagnostics\CommonDiagnosticAnalyzers.cs (8)
384params (string DescriptorId, int DescriptorIndex, ImmutableHashSet<ReportDiagnostic> EffectiveSeverities)[] overriddenEffectiveSeveritiesWithIndex) 395foreach (var effectiveSeverity in effectiveSeverities.OrderBy(Comparer<ReportDiagnostic>.Default)) 428private static string GetConfigurationPropertyString(ReportDiagnostic severity) 430if (severity == ReportDiagnostic.Suppress) 435ReportDiagnostic.Error => "error", 436ReportDiagnostic.Warn => "warning", 437ReportDiagnostic.Info or ReportDiagnostic.Hidden => "note",
Diagnostics\DiagnosticExtensions.cs (5)
213if (c.Options.GeneralDiagnosticOption == ReportDiagnostic.Default && 234var toggledOption = c.Options.GeneralDiagnosticOption == ReportDiagnostic.Error ? 235ReportDiagnostic.Default : 236ReportDiagnostic.Error;
Diagnostics\ReportDiagnosticExtensions.cs (6)
13public static string ToAnalyzerConfigString(this ReportDiagnostic reportDiagnostic) 17ReportDiagnostic.Error => "error", 18ReportDiagnostic.Warn => "warning", 19ReportDiagnostic.Info => "suggestion", 20ReportDiagnostic.Hidden => "silent", 21ReportDiagnostic.Suppress => "none",
Mocks\TestMessageProvider.cs (1)
36public override ReportDiagnostic GetDiagnosticReport(DiagnosticInfo diagnosticInfo, CompilationOptions options)
Microsoft.CodeAnalysis.UnitTests (94)
Analyzers\AnalyzerConfigTests.cs (39)
964CreateImmutableDictionary(("cs000", ReportDiagnostic.Suppress)), 965CreateImmutableDictionary(("cs000", ReportDiagnostic.Error)), 993CreateImmutableDictionary(("cs000", ReportDiagnostic.Suppress)) 1014CreateImmutableDictionary(("cs000", ReportDiagnostic.Error)), 1015CreateImmutableDictionary(("cs000", ReportDiagnostic.Error)), 1041CreateImmutableDictionary(("cs000", ReportDiagnostic.Suppress)), 1042CreateImmutableDictionary(("cs000", ReportDiagnostic.Error)), 1064("cs000", ReportDiagnostic.Suppress), 1065("cs001", ReportDiagnostic.Info)), 1086("cs000", ReportDiagnostic.Hidden), 1087("cs001", ReportDiagnostic.Hidden)), 1110("cs000", ReportDiagnostic.Suppress), 1111("cs001", ReportDiagnostic.Info)) 1140("cs000", ReportDiagnostic.Warn), 1141("cs001", ReportDiagnostic.Error)), 1143("cs000", ReportDiagnostic.Warn), 1144("cs001", ReportDiagnostic.Info)) 1166("cs000", ReportDiagnostic.Info)), 1192("cs001", ReportDiagnostic.Info)), 1194("cs000", ReportDiagnostic.Suppress), 1195("cs001", ReportDiagnostic.Error)), 1197("cs000", ReportDiagnostic.Suppress)) 1217("cs000", ReportDiagnostic.Suppress)) 1253(string diagId, ReportDiagnostic severity)[][] expected, 1270Assert.True(treeOptions.TryGetValue(item.diagId, out var severity)); 1410new[] { ("cs000", ReportDiagnostic.Suppress) }, 1411new[] { ("cs000", ReportDiagnostic.Error) }, 1412new[] { ("cs000", ReportDiagnostic.Warn) } 1510CreateImmutableDictionary(("", ReportDiagnostic.Warn)), 1538Assert.Equal(new ImmutableDictionary<string, ReportDiagnostic>[] 1571("cs000", ReportDiagnostic.Warn)), 1573("cs000", ReportDiagnostic.Warn)), 1609Assert.Equal(KeyValuePair.Create("cs000", ReportDiagnostic.Warn), options[0].TreeOptions.Single()); 2033Assert.Equal(CreateImmutableDictionary(("cs000", ReportDiagnostic.Suppress), 2034("cs001", ReportDiagnostic.Error)), 2056CreateImmutableDictionary(("cs000", ReportDiagnostic.Error)) 2103CreateImmutableDictionary(("cs000", ReportDiagnostic.Error)), 2132CreateImmutableDictionary(("cs000", ReportDiagnostic.Suppress)), 2133CreateImmutableDictionary(("cs000", ReportDiagnostic.Warn))
CommonCommandLineParserTests.cs (54)
167Assert.Equal(expected: ReportDiagnostic.Error, actual: ruleSet.SpecificDiagnosticOptions["CA1012"]); 202Assert.Equal(ReportDiagnostic.Warn, ruleSet.GeneralDiagnosticOption); 216Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption); 231Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption); 256Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption); 291Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption); 411Assert.Equal(ReportDiagnostic.Error, ruleSet.SpecificDiagnosticOptions["CA1012"]); 413Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]); 415Assert.Equal(ReportDiagnostic.Suppress, ruleSet.SpecificDiagnosticOptions["CA1014"]); 417Assert.Equal(ReportDiagnostic.Info, ruleSet.SpecificDiagnosticOptions["CA1015"]); 419Assert.Equal(ReportDiagnostic.Hidden, ruleSet.SpecificDiagnosticOptions["CA1016"]); 452Assert.Equal(ReportDiagnostic.Default, ruleSet.Includes.First().Action); 476Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption); 478Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]); 501Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption); 503Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]); 505Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]); 529Assert.Equal(ReportDiagnostic.Hidden, ruleSet.GeneralDiagnosticOption); 531Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]); 533Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]); 557Assert.Equal(ReportDiagnostic.Info, ruleSet.GeneralDiagnosticOption); 559Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]); 561Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]); 586Assert.Equal(ReportDiagnostic.Error, ruleSet.GeneralDiagnosticOption); 588Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]); 590Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]); 624Assert.Equal(ReportDiagnostic.Error, ruleSet.GeneralDiagnosticOption); 626Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]); 628Assert.Equal(ReportDiagnostic.Error, ruleSet.SpecificDiagnosticOptions["CA1013"]); 662Assert.Equal(ReportDiagnostic.Error, ruleSet.GeneralDiagnosticOption); 664Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]); 666Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]); 668Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1014"]); 694Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]); 730Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]); 764Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]); 767Assert.Equal(ReportDiagnostic.Error, ruleSet.SpecificDiagnosticOptions["CA1013"]); 791Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]); 815Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]); 817Assert.Equal(ReportDiagnostic.Error, ruleSet.SpecificDiagnosticOptions["CA1013"]); 818Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption); 841Assert.Equal(ReportDiagnostic.Error, ruleSet.GeneralDiagnosticOption); 864Assert.Equal(ReportDiagnostic.Warn, ruleSet.GeneralDiagnosticOption); 887Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]); 889Assert.Equal(ReportDiagnostic.Suppress, ruleSet.SpecificDiagnosticOptions["CA1013"]); 912Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]); 914Assert.Equal(ReportDiagnostic.Error, ruleSet.SpecificDiagnosticOptions["CA1013"]); 952Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1000"]); 953Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1001"]); 954Assert.Equal(ReportDiagnostic.Error, ruleSet.SpecificDiagnosticOptions["CA2100"]); 955Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA2104"]); 956Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA2105"]); 957Assert.Equal(ReportDiagnostic.Suppress, ruleSet.SpecificDiagnosticOptions["CA2111"]); 958Assert.Equal(ReportDiagnostic.Suppress, ruleSet.SpecificDiagnosticOptions["CA2119"]);
Diagnostics\CompilationWithAnalyzersTests.cs (1)
41new[] { KeyValuePairUtil.Create($"CS{(int)ErrorCode.WRN_AlwaysNull:D4}", ReportDiagnostic.Suppress) }));
Microsoft.CodeAnalysis.VisualBasic (99)
CommandLine\VisualBasicCommandLineParser.vb (23)
148Dim generalDiagnosticOption As ReportDiagnostic = ReportDiagnostic.Default 152Dim specificDiagnosticOptionsFromRuleSet = New Dictionary(Of String, ReportDiagnostic)(CaseInsensitiveComparison.Comparer) 153Dim specificDiagnosticOptionsFromGeneralArguments = New Dictionary(Of String, ReportDiagnostic)(CaseInsensitiveComparison.Comparer) 154Dim specificDiagnosticOptionsFromSpecificArguments = New Dictionary(Of String, ReportDiagnostic)(CaseInsensitiveComparison.Comparer) 155Dim specificDiagnosticOptionsFromNoWarnArguments = New Dictionary(Of String, ReportDiagnostic)(CaseInsensitiveComparison.Comparer) 828generalDiagnosticOption = ReportDiagnostic.Error 832If pair.Value = ReportDiagnostic.Warn Then 833specificDiagnosticOptionsFromGeneralArguments.Add(pair.Key, ReportDiagnostic.Error) 840AddWarnings(specificDiagnosticOptionsFromSpecificArguments, ReportDiagnostic.Error, ParseWarnings(value)) 845If generalDiagnosticOption <> ReportDiagnostic.Suppress Then 846generalDiagnosticOption = ReportDiagnostic.Default 855Dim ruleSetValue As ReportDiagnostic 859specificDiagnosticOptionsFromSpecificArguments(id) = ReportDiagnostic.Default 867generalDiagnosticOption = ReportDiagnostic.Suppress 871If pair.Value <> ReportDiagnostic.Error Then 872specificDiagnosticOptionsFromGeneralArguments.Add(pair.Key, ReportDiagnostic.Suppress) 879AddWarnings(specificDiagnosticOptionsFromNoWarnArguments, ReportDiagnostic.Suppress, ParseWarnings(value)) 1283Dim specificDiagnosticOptions = New Dictionary(Of String, ReportDiagnostic)(specificDiagnosticOptionsFromRuleSet, CaseInsensitiveComparison.Comparer) 2260Private Shared Sub AddWarnings(d As IDictionary(Of String, ReportDiagnostic), kind As ReportDiagnostic, items As IEnumerable(Of String)) 2262Dim existing As ReportDiagnostic 2265If existing <> ReportDiagnostic.Suppress Then
Compilation\VisualBasicDiagnosticFilter.vb (27)
31generalDiagnosticOption As ReportDiagnostic, 32specificDiagnosticOptions As IDictionary(Of String, ReportDiagnostic), 38ImmutableDictionary.Create(Of String, ReportDiagnostic)(CaseInsensitiveComparison.Comparer).AddRange(specificDiagnosticOptions) 66Dim report As ReportDiagnostic 130generalDiagnosticOption As ReportDiagnostic, 131caseInsensitiveSpecificDiagnosticOptions As IDictionary(Of String, ReportDiagnostic), 134<Out> ByRef hasDisableDirectiveSuppression As Boolean) As ReportDiagnostic 137Dim report As ReportDiagnostic 148If report = ReportDiagnostic.Default Then 166If report = ReportDiagnostic.Warn AndAlso generalDiagnosticOption = ReportDiagnostic.Error AndAlso Not specifiedWarnAsErrorMinus Then 167report = ReportDiagnostic.Error 180Dim reportFromSyntaxTreeOptions As ReportDiagnostic 183Not (specifiedWarnAsErrorMinus AndAlso severity = DiagnosticSeverity.Warning AndAlso reportFromSyntaxTreeOptions = ReportDiagnostic.Error) Then 188If Not specifiedWarnAsErrorMinus AndAlso report = ReportDiagnostic.Warn AndAlso generalDiagnosticOption = ReportDiagnostic.Error Then 189report = ReportDiagnostic.Error 195report = If(isEnabledByDefault, ReportDiagnostic.Default, ReportDiagnostic.Suppress) 199If report = ReportDiagnostic.Suppress Then 200Return ReportDiagnostic.Suppress 205location.SourceTree.GetWarningState(id, location.SourceSpan.Start) = ReportDiagnostic.Suppress Then 216If generalDiagnosticOption = ReportDiagnostic.Suppress AndAlso 218Return ReportDiagnostic.Suppress 223If (generalDiagnosticOption = ReportDiagnostic.Error) AndAlso (severity = DiagnosticSeverity.Warning) Then 227If (Not isSpecified) AndAlso (report = ReportDiagnostic.Default) Then 228Return ReportDiagnostic.Error
Errors\MessageProvider.vb (1)
116Public Overrides Function GetDiagnosticReport(diagnosticInfo As DiagnosticInfo, options As CompilationOptions) As ReportDiagnostic
Syntax\SyntaxNodeFactories.vb (2)
76Optional diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing, 89Optional diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing,
Syntax\VisualBasicSyntaxTree.DummySyntaxTree.vb (2)
55Public Overrides ReadOnly Property DiagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) 98Public Overrides Function WithDiagnosticOptions(options As ImmutableDictionary(Of String, ReportDiagnostic)) As SyntaxTree
Syntax\VisualBasicSyntaxTree.LazySyntaxTree.vb (4)
20Private ReadOnly _diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) 29diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic)) 101Public Overrides ReadOnly Property DiagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) 153Public Overrides Function WithDiagnosticOptions(options As ImmutableDictionary(Of String, ReportDiagnostic)) As SyntaxTree
Syntax\VisualBasicSyntaxTree.ParsedSyntaxTree.vb (4)
29Private ReadOnly _diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) 43diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic), 126Public Overrides ReadOnly Property DiagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) 173Public Overrides Function WithDiagnosticOptions(options As ImmutableDictionary(Of String, ReportDiagnostic)) As SyntaxTree
Syntax\VisualBasicSyntaxTree.vb (6)
164Optional diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing) As SyntaxTree 239Optional diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing, 249Optional diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing, 266Optional diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing, 282Optional diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing, 473Friend Function GetWarningState(id As String, position As Integer) As ReportDiagnostic
Syntax\VisualBasicWarningStateMap.vb (8)
11Inherits AbstractWarningStateMap(Of ReportDiagnostic) 50entries(index) = New WarningStateMapEntry(0, ReportDiagnostic.Default, Nothing) 53Dim accumulatedGeneralWarningState = ReportDiagnostic.Default 56Dim accumulatedSpecificWarningState = ImmutableDictionary.Create(Of String, ReportDiagnostic)(CaseInsensitiveComparison.Comparer) 60Dim reportingState As ReportDiagnostic 65reportingState = ReportDiagnostic.Default 68reportingState = ReportDiagnostic.Suppress 77accumulatedSpecificWarningState = ImmutableDictionary.Create(Of String, ReportDiagnostic)(CaseInsensitiveComparison.Comparer)
VisualBasicCompilationOptions.vb (21)
88Optional generalDiagnosticOption As ReportDiagnostic = ReportDiagnostic.Default, 89Optional specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic)) = Nothing, 165generalDiagnosticOption As ReportDiagnostic, 166specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic)), 234generalDiagnosticOption As ReportDiagnostic, 235specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic)), 811Protected Overrides Function CommonWithGeneralDiagnosticOption(value As ReportDiagnostic) As CompilationOptions 815Protected Overrides Function CommonWithSpecificDiagnosticOptions(specificDiagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic)) As CompilationOptions 819Protected Overrides Function CommonWithSpecificDiagnosticOptions(specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic))) As CompilationOptions 841Public Shadows Function WithGeneralDiagnosticOption(value As ReportDiagnostic) As VisualBasicCompilationOptions 854Public Shadows Function WithSpecificDiagnosticOptions(value As ImmutableDictionary(Of String, ReportDiagnostic)) As VisualBasicCompilationOptions 856value = ImmutableDictionary(Of String, ReportDiagnostic).Empty 871Public Shadows Function WithSpecificDiagnosticOptions(value As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic))) As VisualBasicCompilationOptions 1164generalDiagnosticOption As ReportDiagnostic, 1165specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic)), 1229generalDiagnosticOption As ReportDiagnostic, 1230specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic)), 1295Optional generalDiagnosticOption As ReportDiagnostic = ReportDiagnostic.Default, 1296Optional specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic)) = Nothing,
VisualBasicExtensions.vb (1)
512Friend Function GetWarningState(tree As SyntaxTree, id As String, position As Integer) As ReportDiagnostic
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (60)
CommandLineTests.vb (60)
134Dim report As ReportDiagnostic 136Assert.Equal(ReportDiagnostic.Suppress, report) 138Assert.Equal(ReportDiagnostic.Suppress, report) 140Assert.Equal(ReportDiagnostic.Suppress, report) 288Assert.Equal(cmd.Arguments.CompilationOptions.GeneralDiagnosticOption, ReportDiagnostic.Suppress) 291Assert.Equal(cmd.Arguments.CompilationOptions.GeneralDiagnosticOption, ReportDiagnostic.Error) 294Assert.Equal(cmd.Arguments.CompilationOptions.GeneralDiagnosticOption, ReportDiagnostic.Error) 297Assert.Equal(cmd.Arguments.CompilationOptions.GeneralDiagnosticOption, ReportDiagnostic.Suppress) 300Assert.Equal(cmd.Arguments.CompilationOptions.GeneralDiagnosticOption, ReportDiagnostic.Suppress) 303Assert.Equal(cmd.Arguments.CompilationOptions.GeneralDiagnosticOption, ReportDiagnostic.Suppress) 2843Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions("CA1012") = ReportDiagnostic.Error) 2845Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions("CA1013") = ReportDiagnostic.Warn) 2847Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions("CA1014") = ReportDiagnostic.Suppress) 2848Assert.True(parsedArgs.CompilationOptions.GeneralDiagnosticOption = ReportDiagnostic.Warn) 5759Private Shared Sub AssertSpecificDiagnostics(expectedCodes As Integer(), expectedOptions As ReportDiagnostic(), args As VisualBasicCommandLineArguments) 5773Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption) 5777Assert.Equal(ReportDiagnostic.Error, parsedArgs.CompilationOptions.GeneralDiagnosticOption) 5781Assert.Equal(ReportDiagnostic.Error, parsedArgs.CompilationOptions.GeneralDiagnosticOption) 5785Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption) 5789Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption) 5790AssertSpecificDiagnostics({42024, 42025}, {ReportDiagnostic.Error, ReportDiagnostic.Error}, parsedArgs) 5794Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption) 5798Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption) 5799AssertSpecificDiagnostics({42024, 42025}, {ReportDiagnostic.Error, ReportDiagnostic.Error}, parsedArgs) 5803Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption) 5807Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption) 5811Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption) 5812AssertSpecificDiagnostics({42024, 42025}, {ReportDiagnostic.Default, ReportDiagnostic.Default}, parsedArgs) 5816Assert.Equal(ReportDiagnostic.Suppress, parsedArgs.CompilationOptions.GeneralDiagnosticOption) 5820Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption) 5824Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption) 5825AssertSpecificDiagnostics({42024, 42025}, {ReportDiagnostic.Suppress, ReportDiagnostic.Suppress}, parsedArgs) 8693Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption) 8713Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption) 8715Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001")) 8734Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption) 8736Assert.Equal(expected:=ReportDiagnostic.Info, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001")) 8755Assert.Equal(expected:=ReportDiagnostic.Default, actual:=arguments.CompilationOptions.GeneralDiagnosticOption) 8757Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001")) 8776Assert.Equal(expected:=ReportDiagnostic.Default, actual:=arguments.CompilationOptions.GeneralDiagnosticOption) 8778Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001")) 8797Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption) 8799Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001")) 8818Assert.Equal(expected:=ReportDiagnostic.Default, actual:=arguments.CompilationOptions.GeneralDiagnosticOption) 8820Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001")) 8821Assert.Equal(expected:=ReportDiagnostic.Default, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test002")) 8840Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption) 8842Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001")) 8861Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.GeneralDiagnosticOption) 8863Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001")) 8884Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.GeneralDiagnosticOption) 8886Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001")) 8887Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test002")) 8888Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test003")) 8907Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption) 8909Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (3)
Emit\CompilationEmitTests.vb (2)
3936Dim warns = New Dictionary(Of String, ReportDiagnostic) 3937warns.Add(MessageProvider.Instance.GetIdForErrorCode(40010), ReportDiagnostic.Suppress)
PDB\VisualBasicDeterministicBuildCompilationTests.vb (1)
209generalDiagnosticOption:=ReportDiagnostic.Default,
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (101)
Compilation\CompilationAPITests.vb (11)
30ParamArray options As (String, ReportDiagnostic)()) As VisualBasicCompilationOptions 45WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 50New TestSyntaxTreeOptionsProvider(tree, ("BC42024", ReportDiagnostic.Warn))) 73Dim options = WithDiagnosticOptions(tree, ("BC42024", ReportDiagnostic.Suppress)) 92Dim options = WithDiagnosticOptions(tree, ("BC42024", ReportDiagnostic.Warn)) 108CreateImmutableDictionary(("BC42024", ReportDiagnostic.Suppress))) 113New TestSyntaxTreeOptionsProvider(tree, ("BC42024", ReportDiagnostic.Error))) 136(tree, {("BC42024", ReportDiagnostic.Suppress)}), 137(newTree, {("BC4024", ReportDiagnostic.Error)}))) 156Dim options = WithDiagnosticOptions(tree, ("bc42024", ReportDiagnostic.Suppress)) 165(tree, {("bc42024", ReportDiagnostic.Suppress)}))
Compilation\VisualBasicCompilationOptionsTests.vb (31)
38TestHiddenProperty(Function(old, value) old.WithGeneralDiagnosticOption(value), Function(opt) opt.GeneralDiagnosticOption, ReportDiagnostic.Suppress) 41New Dictionary(Of String, ReportDiagnostic) From {{"VB0001", ReportDiagnostic.Error}}.ToImmutableDictionary()) 113TestProperty(Function(old, value) old.WithGeneralDiagnosticOption(value), Function(opt) opt.GeneralDiagnosticOption, ReportDiagnostic.Suppress) 116New Dictionary(Of String, ReportDiagnostic) From {{"VB0001", ReportDiagnostic.Error}}.ToImmutableDictionary()) 427Dim options = commonoption.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 433Dim warnings As IDictionary(Of String, ReportDiagnostic) = New Dictionary(Of String, ReportDiagnostic)() 434warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress) 435options = commonoption.WithSpecificDiagnosticOptions(New ReadOnlyDictionary(Of String, ReportDiagnostic)(warnings)) 443warnings = New Dictionary(Of String, ReportDiagnostic)() 444warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress) 445warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42099), ReportDiagnostic.Suppress) 446options = commonoption.WithSpecificDiagnosticOptions(New ReadOnlyDictionary(Of String, ReportDiagnostic)(warnings)) 452options = commonoption.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 462warnings = New Dictionary(Of String, ReportDiagnostic)() 463warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42105), ReportDiagnostic.Error) 464options = commonoption.WithSpecificDiagnosticOptions(New ReadOnlyDictionary(Of String, ReportDiagnostic)(warnings)) 474warnings = New Dictionary(Of String, ReportDiagnostic)() 475warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42105), ReportDiagnostic.Error) 476warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42099), ReportDiagnostic.Error) 477options = commonoption.WithSpecificDiagnosticOptions(New ReadOnlyDictionary(Of String, ReportDiagnostic)(warnings)) 487warnings = New Dictionary(Of String, ReportDiagnostic)() 488warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress) 489options = commonoption.WithSpecificDiagnosticOptions(New ReadOnlyDictionary(Of String, ReportDiagnostic)(warnings)).WithGeneralDiagnosticOption(ReportDiagnostic.Error) 498warnings = New Dictionary(Of String, ReportDiagnostic)() 499warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error) 500options = commonoption.WithSpecificDiagnosticOptions(New ReadOnlyDictionary(Of String, ReportDiagnostic)(warnings)).WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
Diagnostics\DiagnosticAnalyzerTests.vb (50)
62Dim specificDiagOptions = New Dictionary(Of String, ReportDiagnostic)() 63specificDiagOptions.Add(noneDiagDescriptor.Id, ReportDiagnostic.[Error]) 64specificDiagOptions.Add(infoDiagDescriptor.Id, ReportDiagnostic.[Error]) 65specificDiagOptions.Add(warningDiagDescriptor.Id, ReportDiagnostic.[Error]) 77specificDiagOptions = New Dictionary(Of String, ReportDiagnostic)() 78specificDiagOptions.Add(noneDiagDescriptor.Id, ReportDiagnostic.Suppress) 79specificDiagOptions.Add(infoDiagDescriptor.Id, ReportDiagnostic.Suppress) 80specificDiagOptions.Add(warningDiagDescriptor.Id, ReportDiagnostic.Suppress) 81specificDiagOptions.Add(errorDiagDescriptor.Id, ReportDiagnostic.Suppress) 89specificDiagOptions = New Dictionary(Of String, ReportDiagnostic)() 90specificDiagOptions.Add(noneDiagDescriptor.Id, ReportDiagnostic.Info) 91specificDiagOptions.Add(infoDiagDescriptor.Id, ReportDiagnostic.Hidden) 92specificDiagOptions.Add(warningDiagDescriptor.Id, ReportDiagnostic.[Error]) 93specificDiagOptions.Add(errorDiagDescriptor.Id, ReportDiagnostic.Warn) 142Dim options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Default) 147options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 153options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Warn) 160options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Info) 167options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Hidden) 174options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 201Dim specificDiagOptions = New Dictionary(Of String, ReportDiagnostic)() 202specificDiagOptions.Add(disabledDiagDescriptor.Id, ReportDiagnostic.Warn) 203specificDiagOptions.Add(enabledDiagDescriptor.Id, ReportDiagnostic.Suppress) 253Dim specificDiagOptions = New Dictionary(Of String, ReportDiagnostic)() 254specificDiagOptions.Add(FullyDisabledAnalyzer.desc1.Id, ReportDiagnostic.Warn) 255specificDiagOptions.Add(PartiallyDisabledAnalyzer.desc2.Id, ReportDiagnostic.Suppress) 684Dim specificDiagOptions = New Dictionary(Of String, ReportDiagnostic) 685specificDiagOptions.Add(NotConfigurableDiagnosticAnalyzer.EnabledRule.Id, ReportDiagnostic.Suppress) 698specificDiagOptions.Add(NotConfigurableDiagnosticAnalyzer.DisabledRule.Id, ReportDiagnostic.Warn) 752Private Shared Sub TestEffectiveSeverity(defaultSeverity As DiagnosticSeverity, expectedEffectiveSeverity As ReportDiagnostic, Optional specificOptions As Dictionary(Of String, ReportDiagnostic) = Nothing, Optional generalOption As ReportDiagnostic = ReportDiagnostic.Default, Optional isEnabledByDefault As Boolean = True) 753specificOptions = If(specificOptions, New Dictionary(Of String, ReportDiagnostic)) 766TestEffectiveSeverity(DiagnosticSeverity.Warning, ReportDiagnostic.Warn) 773Dim specificOptions = New Dictionary(Of String, ReportDiagnostic) From {{"Test0001", ReportDiagnostic.Default}} 774Dim generalOption = ReportDiagnostic.Error 776TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity:=ReportDiagnostic.Warn, specificOptions:=specificOptions, generalOption:=generalOption) 783Dim generalOption = ReportDiagnostic.Error 791Dim specificOption = ReportDiagnostic.Suppress 792Dim specificOptions = New Dictionary(Of String, ReportDiagnostic) From {{"Test0001", specificOption}} 793Dim generalOption = ReportDiagnostic.Error 802Dim generalOption = ReportDiagnostic.Error 805TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity:=ReportDiagnostic.Suppress, generalOption:=generalOption, isEnabledByDefault:=enabledByDefault) 812Dim specificOption = ReportDiagnostic.Warn 813Dim specificOptions = New Dictionary(Of String, ReportDiagnostic) From {{"Test0001", specificOption}} 814Dim generalOption = ReportDiagnostic.Error 899Dim options = compilation.Options.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 1291If compilation.Options.GeneralDiagnosticOption = ReportDiagnostic.Error Then
Semantics\AsyncAwait.vb (3)
5501Dim warnings = New Dictionary(Of String, ReportDiagnostic)() 5502warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42356), ReportDiagnostic.Suppress) 5505TestOptions.ReleaseExe.WithSpecificDiagnosticOptions(New ReadOnlyDictionary(Of String, ReportDiagnostic)(warnings)))
SourceGeneration\GeneratorDriverTests.vb (6)
195Dim warnings As IDictionary(Of String, ReportDiagnostic) = New Dictionary(Of String, ReportDiagnostic)() 196warnings.Add("GEN001", ReportDiagnostic.Suppress) 201warnings.Add("GEN002", ReportDiagnostic.Suppress) 206warnings.Add("GEN001", ReportDiagnostic.Error) 212warnings.Add("GEN002", ReportDiagnostic.Error)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (2)
UsedAssembliesTests.vb (2)
3664WithSpecificDiagnosticOptions({KeyValuePairUtil.Create("BC40057", ReportDiagnostic.Suppress)}), 3676WithSpecificDiagnosticOptions({KeyValuePairUtil.Create("BC40057", ReportDiagnostic.Suppress)}),
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (153)
Parser\ParseDirectives.vb (145)
2785Dim diagOptions = New Dictionary(Of String, ReportDiagnostic) 2786diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error) 2791diagOptions = New Dictionary(Of String, ReportDiagnostic) 2792diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress) 2796compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 2800compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 2825Dim diagOptions = New Dictionary(Of String, ReportDiagnostic) 2826diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error) 2831diagOptions = New Dictionary(Of String, ReportDiagnostic) 2832diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress) 2836compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 2840compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 2865Dim diagOptions = New Dictionary(Of String, ReportDiagnostic) 2866diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error) 2871diagOptions = New Dictionary(Of String, ReportDiagnostic) 2872diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress) 2876compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 2880compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 2905Dim diagOptions = New Dictionary(Of String, ReportDiagnostic) 2906diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error) 2911diagOptions = New Dictionary(Of String, ReportDiagnostic) 2912diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress) 2916compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 2920compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 2945Dim diagOptions = New Dictionary(Of String, ReportDiagnostic) 2946diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error) 2953diagOptions = New Dictionary(Of String, ReportDiagnostic) 2954diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress) 2959compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 2965compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 2990Dim diagOptions = New Dictionary(Of String, ReportDiagnostic) 2991diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error) 2998diagOptions = New Dictionary(Of String, ReportDiagnostic) 2999diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress) 3004compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 3010compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 3036Dim diagOptions = New Dictionary(Of String, ReportDiagnostic) 3037diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error) 3043diagOptions = New Dictionary(Of String, ReportDiagnostic) 3044diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress) 3049compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 3054compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 3079Dim diagOptions = New Dictionary(Of String, ReportDiagnostic) 3080diagOptions.Add("Bc42024", ReportDiagnostic.Error) 3086diagOptions = New Dictionary(Of String, ReportDiagnostic) 3087diagOptions.Add("bc42024", ReportDiagnostic.Suppress) 3092compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 3097compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 3128Dim diagOptions = New Dictionary(Of String, ReportDiagnostic) 3129diagOptions.Add("BC42024", ReportDiagnostic.Error) 3135diagOptions = New Dictionary(Of String, ReportDiagnostic) 3136diagOptions.Add("bC42024", ReportDiagnostic.Suppress) 3141compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 3146compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 3218Dim diagOptions = New Dictionary(Of String, ReportDiagnostic) 3219diagOptions.Add("soMeId", ReportDiagnostic.Error) 3224diagOptions = New Dictionary(Of String, ReportDiagnostic) 3225diagOptions.Add("SoMeiD", ReportDiagnostic.Suppress) 3229compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 3233compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 3260Dim diagOptions = New Dictionary(Of String, ReportDiagnostic) 3261diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error) 3268diagOptions = New Dictionary(Of String, ReportDiagnostic) 3269diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress) 3274compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 3280compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 3325Dim diagOptions = New Dictionary(Of String, ReportDiagnostic) 3326diagOptions.Add("__someThing_123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789023456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678902345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789023456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678902345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789023456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678902345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ReportDiagnostic.Error) 3331diagOptions = New Dictionary(Of String, ReportDiagnostic) 3332diagOptions.Add("__somethIng_123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789023456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678902345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789023456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678902345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789023456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678902345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ReportDiagnostic.Suppress) 3336compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error) 3340compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress) 3413Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", 0)) 3414Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", 1)) 3415Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42104", 0)) 3416Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42104", 1)) 3418Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#Disable Warning") - 1)) 3419Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42104", GetEndPosition(tree, "#Disable Warning") - 1)) 3421Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#Disable Warning"))) 3422Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetStartPosition(tree, "Module Program"))) 3423Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "Module Program"))) 3424Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetStartPosition(tree, "#enable Warning"))) 3425Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bC42104", GetEndPosition(tree, "#Disable Warning"))) 3426Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bC42104", GetStartPosition(tree, "Module Program"))) 3427Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bC42104", GetEndPosition(tree, "Module Program"))) 3428Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bC42104", GetStartPosition(tree, "#enable Warning"))) 3430Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#enable Warning"))) 3431Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "Sub Main()"))) 3432Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("bc42104", GetEndPosition(tree, "#enable Warning"))) 3433Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("bc42104", GetStartPosition(tree, "Sub Main()"))) 3435Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#Disable Warning BC42024"))) 3436Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "Dim b"))) 3437Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("Bc42104", GetEndPosition(tree, "#Disable Warning BC42024"))) 3438Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("Bc42104", GetEndPosition(tree, "Dim b"))) 3440Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#enable warning [bc42024]") - 1)) 3441Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#enable warning [bc42024]"))) 3442Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "Dim d"))) 3443Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("Bc42104", GetEndPosition(tree, "#enable warning [bc42024]") - 1)) 3444Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("Bc42104", GetEndPosition(tree, "#enable warning [bc42024]"))) 3445Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("Bc42104", GetEndPosition(tree, "Dim d"))) 3447Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#disable warning BC42024") - 1)) 3448Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#disable warning BC42024"))) 3449Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#disable warning BC42024, [bc42104]") - 1)) 3450Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#disable warning BC42024, [bc42104]"))) 3451Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "End Module"))) 3452Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("bc42104", GetEndPosition(tree, "#disable warning BC42024"))) 3453Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("bc42104", GetEndPosition(tree, "#disable warning BC42024, [bc42104]") - 1)) 3454Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bc42104", GetEndPosition(tree, "#disable warning BC42024, [bc42104]"))) 3455Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bc42104", GetEndPosition(tree, "End Module"))) 3457Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#enable Warning") - 1)) 3458Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#enable Warning"))) 3459Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bc42104", GetEndPosition(tree, "#enable Warning") - 1)) 3460Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("bc42104", GetEndPosition(tree, "#enable Warning"))) 3463Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", endPos - 1)) 3464Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", endPos)) 3465Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bc42104", endPos - 1)) 3466Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("bc42104", endPos)) 3492Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", 0)) 3493Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", 1)) 3494Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", 0)) 3495Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", 1)) 3497Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetStartPosition(tree, "#disable warning bc42024, bc42025"))) 3498Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#disable warning bc42024, bc42025") + 1)) 3499Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", GetStartPosition(tree, "#disable warning bc42024, bc42025"))) 3500Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", GetEndPosition(tree, "#disable warning bc42024, bc42025") + 1)) 3502Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetStartPosition(tree, "#Disable Warning bc42024, [BC42025]"))) 3503Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#Disable Warning bc42024, [BC42025]"))) 3504Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", GetStartPosition(tree, "#Disable Warning bc42024, [BC42025]"))) 3505Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42025", GetEndPosition(tree, "#Disable Warning bc42024, [BC42025]"))) 3507Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetStartPosition(tree, "#enable warning bc42024, bc42025"))) 3508Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#enable warning bc42024, bc42025"))) 3509Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42025", GetStartPosition(tree, "#enable warning bc42024, bc42025"))) 3510Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42025", GetEndPosition(tree, "#enable warning bc42024, bc42025"))) 3512Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetStartPosition(tree, "#Enable Warning [bc42025], [bC42024]") + 1)) 3513Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#Enable Warning [bc42025], [bC42024]"))) 3514Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42025", GetStartPosition(tree, "#Enable Warning [bc42025], [bC42024]") + 1)) 3515Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", GetEndPosition(tree, "#Enable Warning [bc42025], [bC42024]"))) 3517Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetStartPosition(tree, "#Disable Warning bc42024, bc42025"))) 3518Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#Disable Warning bc42024, bc42025"))) 3519Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", GetStartPosition(tree, "#Disable Warning bc42024, bc42025"))) 3520Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", GetEndPosition(tree, "#Disable Warning bc42024, bc42025"))) 3523Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", endPos - 1)) 3524Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", endPos)) 3525Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", endPos - 1)) 3526Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", endPos))
Syntax\SyntaxTreeTests.vb (8)
25Dim options = CreateImmutableDictionary(("BC000", ReportDiagnostic.Suppress)) 32Dim options = CreateImmutableDictionary(("BC000", ReportDiagnostic.Suppress)) 49Assert.NotSame(ImmutableDictionary(Of String, ReportDiagnostic).Empty, tree.DiagnosticOptions) 56diagnosticOptions:=ImmutableDictionary(Of String, ReportDiagnostic).Empty) 59Assert.Same(ImmutableDictionary(Of String, ReportDiagnostic).Empty, tree.DiagnosticOptions) 64Dim options = CreateImmutableDictionary(("BC000", ReportDiagnostic.Suppress)) 90Dim newTree = tree.WithDiagnosticOptions(ImmutableDictionary(Of String, ReportDiagnostic).Empty) 100Dim map = CreateImmutableDictionary(("BC000", ReportDiagnostic.Suppress))
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
ParserTestUtilities.vb (2)
539Public Overrides ReadOnly Property DiagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) 557Public Overrides Function WithDiagnosticOptions(options As ImmutableDictionary(Of String, ReportDiagnostic)) As SyntaxTree
Microsoft.CodeAnalysis.Workspaces (135)
CodeStyle\NotificationOption.cs (1)
29public ReportDiagnostic Severity
CodeStyle\NotificationOption2_operators.cs (11)
14ReportDiagnostic.Suppress => NotificationOption.None, 15ReportDiagnostic.Hidden => NotificationOption.Silent, 16ReportDiagnostic.Info => NotificationOption.Suggestion, 17ReportDiagnostic.Warn => NotificationOption.Warning, 18ReportDiagnostic.Error => NotificationOption.Error, 25public static string GetDisplayString(this ReportDiagnostic severity) 28ReportDiagnostic.Suppress => WorkspacesResources.None, 29ReportDiagnostic.Hidden => WorkspacesResources.Refactoring_Only, 30ReportDiagnostic.Info => WorkspacesResources.Suggestion, 31ReportDiagnostic.Warn => WorkspacesResources.Warning, 32ReportDiagnostic.Error => WorkspacesResources.Error,
Diagnostics\DiagnosticData.cs (8)
291var reportDiagnostic = descriptor.GetEffectiveSeverity(project.CompilationOptions!); 292if (reportDiagnostic == ReportDiagnostic.Suppress) 310private static DiagnosticSeverity GetEffectiveSeverity(ReportDiagnostic effectiveReportDiagnostic, DiagnosticSeverity defaultSeverity) 314case ReportDiagnostic.Default: 317case ReportDiagnostic.Error: 320case ReportDiagnostic.Hidden: 323case ReportDiagnostic.Info: 326case ReportDiagnostic.Warn:
Serialization\AbstractOptionsSerializationService.cs (8)
90ReportDiagnostic generalDiagnosticOption, 92IEnumerable<KeyValuePair<string, ReportDiagnostic>> specificDiagnosticOptions, 125var generalDiagnosticOption = (ReportDiagnostic)reader.ReadInt32(); 134List<KeyValuePair<string, ReportDiagnostic>> specificDiagnosticOptionsList = null; 138specificDiagnosticOptionsList = new List<KeyValuePair<string, ReportDiagnostic>>(count); 143var value = (ReportDiagnostic)reader.ReadInt32();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (4)
52(true, ReportDiagnostic.Hidden) => TrueWithSilentEnforcement, 53(true, ReportDiagnostic.Info) => TrueWithSuggestionEnforcement, 54(false, ReportDiagnostic.Hidden) => FalseWithSilentEnforcement, 55(false, ReportDiagnostic.Info) => FalseWithSuggestionEnforcement,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\EditorConfigSeverityStrings.cs (6)
18public static bool TryParse(string editorconfigSeverityString, out ReportDiagnostic reportDiagnostic) 23reportDiagnostic = ReportDiagnostic.Suppress; 28reportDiagnostic = ReportDiagnostic.Hidden; 32reportDiagnostic = ReportDiagnostic.Info; 36reportDiagnostic = ReportDiagnostic.Warn; 40reportDiagnostic = ReportDiagnostic.Error;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\NotificationOption2.cs (18)
17[property: DataMember(Order = 0)] ReportDiagnostic Severity, [property: DataMember(Order = 1)] bool IsExplicitlySpecified) 20/// Notification option to disable or suppress an option with <see cref="ReportDiagnostic.Suppress"/>. 22public static NotificationOption2 None => new(ReportDiagnostic.Suppress, false); 25/// Notification option for a silent or hidden option with <see cref="ReportDiagnostic.Hidden"/>. 27public static NotificationOption2 Silent => new(ReportDiagnostic.Hidden, false); 30/// Notification option for a suggestion or an info option with <see cref="ReportDiagnostic.Info"/>. 32public static NotificationOption2 Suggestion => new(ReportDiagnostic.Info, false); 35/// Notification option for a warning option with <see cref="ReportDiagnostic.Warn"/>. 37public static NotificationOption2 Warning => new(ReportDiagnostic.Warn, false); 40/// Notification option for an error option with <see cref="ReportDiagnostic.Error"/>. 42public static NotificationOption2 Error => new(ReportDiagnostic.Error, false); 47public static NotificationOption2 ForSeverity(ReportDiagnostic reportDiagnostic) 50ReportDiagnostic.Error => Error, 51ReportDiagnostic.Warn => Warning, 52ReportDiagnostic.Info => Suggestion, 53ReportDiagnostic.Hidden or ReportDiagnostic.Default => Silent, 54ReportDiagnostic.Suppress => None,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\NamingStyles\NamingStyleOption.cs (1)
25EditorConfigOption<ReportDiagnostic> Severity)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (21)
34public static ReportDiagnostic GetEffectiveSeverity( 38ImmutableDictionary<string, ReportDiagnostic>? treeOptions) 40var effectiveSeverity = descriptor.GetEffectiveSeverity(compilationOptions); 45(!compilationOptions.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out var reportDiagnostic) || 46reportDiagnostic == ReportDiagnostic.Default)) 48if (treeOptions.TryGetValue(descriptor.Id, out reportDiagnostic) && reportDiagnostic != ReportDiagnostic.Default || 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default); 64public static ReportDiagnostic GetEffectiveSeverity(this DiagnosticDescriptor descriptor, CompilationOptions compilationOptions, SyntaxTree tree, AnalyzerOptions analyzerOptions) 66var effectiveSeverity = descriptor.GetEffectiveSeverity(compilationOptions); 70if (!compilationOptions.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out var reportDiagnostic) || 71reportDiagnostic == ReportDiagnostic.Default) 78var severityInEditorConfig = descriptor.GetEffectiveSeverity(analyzerConfigOptions, providerAndTree); 79if (severityInEditorConfig != ReportDiagnostic.Default) 86var severityInGlobalConfig = descriptor.GetEffectiveSeverity(analyzerOptions.AnalyzerConfigOptionsProvider.GlobalOptions, providerAndTree); 87if (severityInGlobalConfig != ReportDiagnostic.Default) 102EditorConfigSeverityStrings.TryParse(value, out var severity)) 145public static ReportDiagnostic GetEffectiveSeverity( 150ReportDiagnostic severity; 182return ReportDiagnostic.Default; 203return ReportDiagnostic.Default; 217out ReportDiagnostic severity)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticSeverityExtensions_Shared.cs (7)
13/// Returns the equivalent <see cref="ReportDiagnostic"/> for a <see cref="DiagnosticSeverity"/> value. 17/// The equivalent <see cref="ReportDiagnostic"/> for the <see cref="DiagnosticSeverity"/> value. 22public static ReportDiagnostic ToReportDiagnostic(this DiagnosticSeverity diagnosticSeverity) 25DiagnosticSeverity.Hidden => ReportDiagnostic.Hidden, 26DiagnosticSeverity.Info => ReportDiagnostic.Info, 27DiagnosticSeverity.Warning => ReportDiagnostic.Warn, 28DiagnosticSeverity.Error => ReportDiagnostic.Error,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ReportDiagnosticExtensions.cs (29)
14/// Returns the equivalent <see cref="DiagnosticSeverity"/> for a <see cref="ReportDiagnostic"/> value. 16/// <param name="reportDiagnostic">The <see cref="ReportDiagnostic"/> value.</param> 18/// The equivalent <see cref="DiagnosticSeverity"/> for a <see cref="ReportDiagnostic"/> value; otherwise, 25public static DiagnosticSeverity? ToDiagnosticSeverity(this ReportDiagnostic reportDiagnostic) 29case ReportDiagnostic.Error: 32case ReportDiagnostic.Warn: 35case ReportDiagnostic.Info: 38case ReportDiagnostic.Hidden: 41case ReportDiagnostic.Suppress: 42case ReportDiagnostic.Default: 51/// Applies a default severity to a <see cref="ReportDiagnostic"/> value. 53/// <param name="reportDiagnostic">The <see cref="ReportDiagnostic"/> value.</param> 56/// <para>If <paramref name="reportDiagnostic"/> is <see cref="ReportDiagnostic.Default"/>, returns 61public static ReportDiagnostic WithDefaultSeverity(this ReportDiagnostic reportDiagnostic, DiagnosticSeverity defaultSeverity) 63if (reportDiagnostic != ReportDiagnostic.Default) 71public static string ToEditorConfigString(this ReportDiagnostic reportDiagnostic) 75ReportDiagnostic.Suppress => EditorConfigSeverityStrings.None, 76ReportDiagnostic.Hidden => EditorConfigSeverityStrings.Silent, 77ReportDiagnostic.Info => EditorConfigSeverityStrings.Suggestion, 78ReportDiagnostic.Warn => EditorConfigSeverityStrings.Warning, 79ReportDiagnostic.Error => EditorConfigSeverityStrings.Error, 84public static NotificationOption2 ToNotificationOption(this ReportDiagnostic reportDiagnostic, DiagnosticSeverity defaultSeverity) 86var isNonDefault = reportDiagnostic != ReportDiagnostic.Default; 89ReportDiagnostic.Error => NotificationOption2.Error, 90ReportDiagnostic.Warn => NotificationOption2.Warning, 91ReportDiagnostic.Info => NotificationOption2.Suggestion, 92ReportDiagnostic.Hidden => NotificationOption2.Silent, 93ReportDiagnostic.Suppress => NotificationOption2.None,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
25var ruleNames = new Dictionary<(Guid symbolSpecificationID, Guid namingStyleID, ReportDiagnostic enforcementLevel), string>();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser_NamingRule.cs (12)
22if (!TryGetRuleSeverity(namingRuleTitle, conventionsDictionary, out var severity)) 41out (ReportDiagnostic severity, TextLine? line) value) 47out ReportDiagnostic severity) 64out (ReportDiagnostic severity, V value) value) 68var severity = ParseEnforcementLevel(valueSelector(result) ?? string.Empty); 77private static ReportDiagnostic ParseEnforcementLevel(string ruleSeverity) 82return ReportDiagnostic.Suppress; 86return ReportDiagnostic.Hidden; 88case EditorConfigSeverityStrings.Suggestion: return ReportDiagnostic.Info; 89case EditorConfigSeverityStrings.Warning: return ReportDiagnostic.Warn; 90case EditorConfigSeverityStrings.Error: return ReportDiagnostic.Error; 91default: return ReportDiagnostic.Hidden;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingRule.cs (2)
11internal readonly struct NamingRule(SymbolSpecification symbolSpecification, NamingStyle namingStyle, ReportDiagnostic enforcementLevel) 15public readonly ReportDiagnostic EnforcementLevel = enforcementLevel;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
24public ReportDiagnostic EnforcementLevel { get; init; }
Workspace\ProjectSystem\IRuleSetFile.cs (2)
17ReportDiagnostic GetGeneralDiagnosticOption(); 18ImmutableDictionary<string, ReportDiagnostic> GetSpecificDiagnosticOptions();
Workspace\Solution\AnalyzerConfigData.cs (1)
24public readonly ImmutableDictionary<string, ReportDiagnostic> TreeOptions;
Workspace\Solution\ProjectState.cs (2)
570public override bool TryGetDiagnosticValue(SyntaxTree tree, string diagnosticId, CancellationToken cancellationToken, out ReportDiagnostic severity) 577public override bool TryGetGlobalDiagnosticValue(string diagnosticId, CancellationToken cancellationToken, out ReportDiagnostic severity)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (6)
Options\OptionsTestHelpers.cs (1)
170EnforcementLevel = ReportDiagnostic.Error
Workspaces\TestWorkspace_XmlConsumption.cs (4)
410var reportDiagnostic = ReportDiagnostic.Default; 450reportDiagnostic = (ReportDiagnostic)Enum.Parse(typeof(ReportDiagnostic), (string)reportDiagnosticAttribute);
Workspaces\TestWorkspace_XmlCreation.cs (1)
163if (options.GeneralDiagnosticOption != ReportDiagnostic.Default)
Microsoft.CodeAnalysis.Workspaces.UnitTests (48)
CodeStyle\EditorConfigCodeStyleParserTests.cs (30)
15[InlineData("true:none", true, ReportDiagnostic.Suppress)] 16[InlineData("true:refactoring", true, ReportDiagnostic.Hidden)] 17[InlineData("true:silent", true, ReportDiagnostic.Hidden)] 18[InlineData("true:suggestion", true, ReportDiagnostic.Info)] 19[InlineData("true:warning", true, ReportDiagnostic.Warn)] 20[InlineData("true:error", true, ReportDiagnostic.Error)] 21[InlineData("true", true, ReportDiagnostic.Hidden)] 22[InlineData("false:none", false, ReportDiagnostic.Suppress)] 23[InlineData("false:refactoring", false, ReportDiagnostic.Hidden)] 24[InlineData("false:silent", false, ReportDiagnostic.Hidden)] 25[InlineData("false:suggestion", false, ReportDiagnostic.Info)] 26[InlineData("false:warning", false, ReportDiagnostic.Warn)] 27[InlineData("false:error", false, ReportDiagnostic.Error)] 28[InlineData("false", false, ReportDiagnostic.Hidden)] 29[InlineData("*", false, ReportDiagnostic.Hidden)] 30[InlineData("false:false", false, ReportDiagnostic.Hidden)] 33[InlineData("true : warning", true, ReportDiagnostic.Warn)] 34[InlineData("false : warning", false, ReportDiagnostic.Warn)] 35[InlineData("true : error", true, ReportDiagnostic.Error)] 36[InlineData("false : error", false, ReportDiagnostic.Error)] 37public void TestParseEditorConfigCodeStyleOption(string args, bool isEnabled, ReportDiagnostic severity) 47[InlineData("never:none", AccessibilityModifiersRequired.Never, ReportDiagnostic.Suppress)] 48[InlineData("always:suggestion", AccessibilityModifiersRequired.Always, ReportDiagnostic.Info)] 49[InlineData("for_non_interface_members:warning", AccessibilityModifiersRequired.ForNonInterfaceMembers, ReportDiagnostic.Warn)] 50[InlineData("omit_if_default:error", AccessibilityModifiersRequired.OmitIfDefault, ReportDiagnostic.Error)] 51[InlineData("never : none", AccessibilityModifiersRequired.Never, ReportDiagnostic.Suppress), WorkItem("https://github.com/dotnet/roslyn/issues/27685")] 52[InlineData("always : suggestion", AccessibilityModifiersRequired.Always, ReportDiagnostic.Info)] 53[InlineData("for_non_interface_members : warning", AccessibilityModifiersRequired.ForNonInterfaceMembers, ReportDiagnostic.Warn)] 54[InlineData("omit_if_default : error", AccessibilityModifiersRequired.OmitIfDefault, ReportDiagnostic.Error)] 55internal void TestParseEditorConfigAccessibilityModifiers(string configurationString, AccessibilityModifiersRequired value, ReportDiagnostic severity)
EditorConfigParsing\NamingStyleParserTests.cs (8)
85Assert.Equal(ReportDiagnostic.Info, rule0.Severity.Value); 122Assert.Equal(ReportDiagnostic.Info, rule1.Severity.Value); 172Assert.Equal(ReportDiagnostic.Info, rule2.Severity.Value); 207Assert.Equal(ReportDiagnostic.Info, rule3.Severity.Value); 243Assert.Equal(ReportDiagnostic.Info, rule4.Severity.Value); 281Assert.Equal(ReportDiagnostic.Info, rule5.Severity.Value); 317Assert.Equal(ReportDiagnostic.Info, rule6.Severity.Value); 354Assert.Equal(ReportDiagnostic.Info, rule7.Severity.Value);
EditorConfigStorageLocation\NamingStylePreferenceEditorConfigStorageLocationTests.cs (1)
36Assert.Equal(ReportDiagnostic.Error, value.Rules.NamingRules[0].EnforcementLevel);
SolutionTests\SolutionTests.cs (9)
4699Assert.True(provider.TryGetDiagnosticValue(newSyntaxTree, "CA1234", CancellationToken.None, out var severity)); 4700Assert.Equal(ReportDiagnostic.Error, severity); 4728Assert.True(provider.TryGetDiagnosticValue(syntaxTreeAfterAddingEditorConfig, "CA1234", CancellationToken.None, out var severity)); 4729Assert.Equal(ReportDiagnostic.Error, severity); 4769Assert.True(provider.TryGetDiagnosticValue(syntaxTreeBeforeEditorConfigChange, "CA1234", CancellationToken.None, out var severity)); 4770Assert.Equal(ReportDiagnostic.Error, severity); 4783Assert.Equal(ReportDiagnostic.Error, severity); 4813Assert.True(newProvider.TryGetGlobalDiagnosticValue("CA1234", default, out var severity)); 4814Assert.Equal(ReportDiagnostic.Error, severity);
Microsoft.VisualStudio.LanguageServices (48)
EditorConfigSettings\Analyzers\View\ColumnDefinitions\AnalyzerSeverityColumnDefinition.cs (5)
44CodeAnalysis.ReportDiagnostic.Suppress => ServicesVSResources.Disabled, 45CodeAnalysis.ReportDiagnostic.Hidden => ServicesVSResources.Refactoring_Only, 46CodeAnalysis.ReportDiagnostic.Info => ServicesVSResources.Suggestion, 47CodeAnalysis.ReportDiagnostic.Warn => ServicesVSResources.Warning, 48CodeAnalysis.ReportDiagnostic.Error => ServicesVSResources.Error,
EditorConfigSettings\Analyzers\ViewModel\SeverityViewModel.cs (11)
51ReportDiagnostic.Suppress => 0, 52ReportDiagnostic.Hidden => 1, 53ReportDiagnostic.Info => 2, 54ReportDiagnostic.Warn => 3, 55ReportDiagnostic.Error => 4, 70var severity = selectedIndex switch 720 => ReportDiagnostic.Suppress, 731 => ReportDiagnostic.Hidden, 742 => ReportDiagnostic.Info, 753 => ReportDiagnostic.Warn, 764 => ReportDiagnostic.Error,
EditorConfigSettings\CodeStyle\ViewModel\CodeStyleSeverityViewModel.cs (9)
53ReportDiagnostic.Hidden => 0, 54ReportDiagnostic.Info => 1, 55ReportDiagnostic.Warn => 2, 56ReportDiagnostic.Error => 3, 65var severity = selectedIndex switch 670 => ReportDiagnostic.Hidden, 681 => ReportDiagnostic.Info, 692 => ReportDiagnostic.Warn, 703 => ReportDiagnostic.Error,
EditorConfigSettings\NamingStyle\View\ColumnDefinitions\NamingStylesSeverityColumnDefinition.cs (6)
47static string GetSeverityString(ReportDiagnostic severity) 50ReportDiagnostic.Suppress => ServicesVSResources.Disabled, 51ReportDiagnostic.Hidden => ServicesVSResources.Refactoring_Only, 52ReportDiagnostic.Info => ServicesVSResources.Suggestion, 53ReportDiagnostic.Warn => ServicesVSResources.Warning, 54ReportDiagnostic.Error => ServicesVSResources.Error,
EditorConfigSettings\NamingStyle\ViewModel\ColumnViewModels\NamingStylesSeverityViewModel.cs (11)
21ReportDiagnostic.Suppress => 0, 22ReportDiagnostic.Hidden => 1, 23ReportDiagnostic.Info => 2, 24ReportDiagnostic.Warn => 3, 25ReportDiagnostic.Error => 4, 34var severity = selectedIndex switch 360 => ReportDiagnostic.Suppress, 371 => ReportDiagnostic.Hidden, 382 => ReportDiagnostic.Info, 393 => ReportDiagnostic.Warn, 404 => ReportDiagnostic.Error,
ProjectSystem\RuleSets\VisualStudioRuleSetManager.RuleSetFile.cs (6)
28private ReportDiagnostic _generalDiagnosticOption; 29private ImmutableDictionary<string, ReportDiagnostic> _specificDiagnosticOptions; 63_specificDiagnosticOptions = ImmutableDictionary<string, ReportDiagnostic>.Empty; 92public ReportDiagnostic GetGeneralDiagnosticOption() 100public ImmutableDictionary<string, ReportDiagnostic> GetSpecificDiagnosticOptions() 127var specificDiagnosticOptions = new Dictionary<string, ReportDiagnostic>();
Microsoft.VisualStudio.LanguageServices.CSharp (15)
ProjectSystemShim\CSharpProjectShim.OptionsProcessor.cs (15)
55IDictionary<string, ReportDiagnostic>? ruleSetSpecificDiagnosticOptions; 59ReportDiagnostic? ruleSetGeneralDiagnosticOption = null; 66ruleSetSpecificDiagnosticOptions = new Dictionary<string, ReportDiagnostic>(ruleSetFile.GetSpecificDiagnosticOptions()); 70ruleSetSpecificDiagnosticOptions = new Dictionary<string, ReportDiagnostic>(); 73ReportDiagnostic generalDiagnosticOption; 77generalDiagnosticOption = warningsAreErrors.Value ? ReportDiagnostic.Error : ReportDiagnostic.Default; 85generalDiagnosticOption = ReportDiagnostic.Default; 89var diagnosticOptions = new Dictionary<string, ReportDiagnostic>(ruleSetSpecificDiagnosticOptions); 96if (pair.Value == ReportDiagnostic.Warn) 98diagnosticOptions[pair.Key] = ReportDiagnostic.Error; 106diagnosticOptions[diagnosticID] = ReportDiagnostic.Error; 111if (ruleSetSpecificDiagnosticOptions.TryGetValue(diagnosticID, out var ruleSetOption)) 117diagnosticOptions[diagnosticID] = ReportDiagnostic.Default; 123diagnosticOptions[diagnosticID] = ReportDiagnostic.Suppress;
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (24)
EditorConfigSettings\DataProvider\DataProviderTests.cs (3)
145Assert.Equal(ReportDiagnostic.Info, namingStyle1.Severity); 151Assert.Equal(ReportDiagnostic.Info, namingStyle2.Severity); 157Assert.Equal(ReportDiagnostic.Info, namingStyle3.Severity);
ProjectSystemShim\CPS\AnalyzersTests.cs (3)
37Assert.Equal(expected: ReportDiagnostic.Default, actual: options.GeneralDiagnosticOption); 44Assert.Equal(expected: ReportDiagnostic.Error, actual: options.GeneralDiagnosticOption); 68Assert.Equal(expected: ReportDiagnostic.Error, actual: ca1012DiagnosticOption);
ProjectSystemShim\CPS\CSharpCompilerOptionsTests.cs (1)
51Assert.Equal(expected: ReportDiagnostic.Error, actual: options.SpecificDiagnosticOptions["CS1111"]);
ProjectSystemShim\LegacyProject\AnalyzersTests.cs (16)
41Assert.Equal(expected: ReportDiagnostic.Default, actual: options.GeneralDiagnosticOption); 47Assert.Equal(expected: ReportDiagnostic.Error, actual: options.GeneralDiagnosticOption); 82Assert.Equal(expected: ReportDiagnostic.Warn, actual: options.GeneralDiagnosticOption); 89Assert.Equal(expected: ReportDiagnostic.Error, actual: options.GeneralDiagnosticOption); 112var ca1012DiagnosticOption = options.SpecificDiagnosticOptions["CA1012"]; 113Assert.Equal(expected: ReportDiagnostic.Error, actual: ca1012DiagnosticOption); 136var ca1014DiagnosticOption = options.SpecificDiagnosticOptions["CS1014"]; 137Assert.Equal(expected: ReportDiagnostic.Error, actual: ca1014DiagnosticOption); 178Assert.Equal(expected: ReportDiagnostic.Error, actual: options.SpecificDiagnosticOptions["CS1014"]); 182Assert.Equal(expected: ReportDiagnostic.Suppress, actual: options.SpecificDiagnosticOptions["CS1014"]); 186Assert.Equal(expected: ReportDiagnostic.Error, actual: options.SpecificDiagnosticOptions["CS1014"]); 190Assert.Equal(expected: ReportDiagnostic.Suppress, actual: options.SpecificDiagnosticOptions["CS1014"]); 216var ca1014DiagnosticOption = options.SpecificDiagnosticOptions["CS1014"]; 217Assert.Equal(expected: ReportDiagnostic.Suppress, actual: ca1014DiagnosticOption); 248Assert.Equal(expected: ReportDiagnostic.Error, actual: options.GeneralDiagnosticOption); 259Assert.Equal(expected: ReportDiagnostic.Warn, actual: options.GeneralDiagnosticOption);
ProjectSystemShim\LegacyProject\CSharpCompilerOptionsTests.cs (1)
96Assert.Equal(expected: ReportDiagnostic.Error, actual: options.SpecificDiagnosticOptions["CS1111"]);
Microsoft.VisualStudio.LanguageServices.UnitTests (57)
ProjectSystemShim\ConvertedVisualBasicProjectOptionsTests.vb (39)
25Dim convertedOptions = GetConvertedOptions(ruleSetGeneralOption:=ReportDiagnostic.Warn, commandLineGeneralOption:=WarningLevel.WARN_AsError) 27Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.GeneralDiagnosticOption) 33Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From 35{"Test001", ReportDiagnostic.Warn} 40Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.GeneralDiagnosticOption) 42Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.SpecificDiagnosticOptions("Test001")) 47Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From 49{"Test001", ReportDiagnostic.Info} 54Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.GeneralDiagnosticOption) 56Assert.Equal(expected:=ReportDiagnostic.Info, actual:=convertedOptions.SpecificDiagnosticOptions("Test001")) 61Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From 63{"Test001", ReportDiagnostic.Info} 71Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.GeneralDiagnosticOption) 73Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.SpecificDiagnosticOptions("Test001")) 78Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From 80{"Test001", ReportDiagnostic.Warn} 88Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.GeneralDiagnosticOption) 90Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=convertedOptions.SpecificDiagnosticOptions("Test001")) 95Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From 97{"Test001", ReportDiagnostic.Warn} 105Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.GeneralDiagnosticOption) 107Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=convertedOptions.SpecificDiagnosticOptions("Test001")) 108Assert.Equal(expected:=ReportDiagnostic.Default, actual:=convertedOptions.SpecificDiagnosticOptions("Test002")) 113Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From 115{"Test001", ReportDiagnostic.Error}, 116{"Test002", ReportDiagnostic.Warn}, 117{"Test003", ReportDiagnostic.Info} 124Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=convertedOptions.GeneralDiagnosticOption) 126Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.SpecificDiagnosticOptions("Test001")) 127Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=convertedOptions.SpecificDiagnosticOptions("Test002")) 128Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=convertedOptions.SpecificDiagnosticOptions("Test003")) 133Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From 135{"Test001", ReportDiagnostic.Warn} 143Assert.Equal(expected:=ReportDiagnostic.Default, actual:=convertedOptions.GeneralDiagnosticOption) 145Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=convertedOptions.SpecificDiagnosticOptions("Test001")) 149Optional ruleSetGeneralOption As ReportDiagnostic = ReportDiagnostic.Default, 150Optional ruleSetSpecificOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing, 156ruleSetSpecificOptions = If(ruleSetSpecificOptions, ImmutableDictionary(Of String, ReportDiagnostic).Empty)
ProjectSystemShim\MockRuleSetFile.vb (6)
14Private ReadOnly _generalOption As ReportDiagnostic 15Private ReadOnly _specificOptions As ImmutableDictionary(Of String, ReportDiagnostic) 17Public Sub New(generalOption As ReportDiagnostic, specificOptions As ImmutableDictionary(Of String, ReportDiagnostic)) 34Public Function GetGeneralDiagnosticOption() As ReportDiagnostic Implements IRuleSetFile.GetGeneralDiagnosticOption 38Public Function GetSpecificDiagnosticOptions() As ImmutableDictionary(Of String, ReportDiagnostic) Implements IRuleSetFile.GetSpecificDiagnosticOptions
ProjectSystemShim\VisualBasicCompilerOptionsTests.vb (1)
191Assert.Equal(ReportDiagnostic.Error, options.SpecificDiagnosticOptions("BC1234"))
ProjectSystemShim\VisualStudioRuleSetTests.vb (1)
274Assert.Equal(expected:=ReportDiagnostic.Default, actual:=generalDiagnosticOption)
SolutionExplorer\AnalyzerCommandHandlerTests.vb (1)
23Dim diagnosticItem = New DiagnosticItem(projectId:=Nothing, analyzerReference:=Nothing, descriptor, ReportDiagnostic.Error, commandHandler:=Nothing)
SolutionExplorer\DiagnosticItemTests.vb (2)
17Dim diagnostic = New DiagnosticItem(projectId:=Nothing, analyzerReference:=Nothing, descriptor, ReportDiagnostic.Error, commandHandler:=Nothing) 26Dim diagnostic = New DiagnosticItem(projectId:=Nothing, analyzerReference:=Nothing, descriptor, ReportDiagnostic.Info, commandHandler:=Nothing)
SolutionExplorer\RuleSetDocumentExtensionsTests.vb (7)
20document.SetSeverity("Alpha.Analyzer", "Test001", ReportDiagnostic.Error) 43document.SetSeverity("Alpha.Analyzer", "Test001", ReportDiagnostic.Warn) 66document.SetSeverity("Beta.Analyzer", "Test001", ReportDiagnostic.Warn) 95document.SetSeverity("Alpha.Analyzer", "Test001", ReportDiagnostic.Error) 118document.SetSeverity("Alpha.Analyzer", "Test001", ReportDiagnostic.Default) 140document.SetSeverity("Alpha.Analyzer", "Test001", ReportDiagnostic.Default) 165document.SetSeverity("Alpha.Analyzer", "Test001", ReportDiagnostic.Default)
Microsoft.VisualStudio.LanguageServices.VisualBasic (23)
ProjectSystemShim\VisualBasicProject.OptionsProcessor.vb (23)
64Dim ruleSetFileGeneralDiagnosticOption As ReportDiagnostic? = Nothing 65Dim ruleSetFileSpecificDiagnosticOptions As IDictionary(Of String, ReportDiagnostic) = Nothing 72Dim generalDiagnosticOption As ReportDiagnostic = DetermineGeneralDiagnosticOption(compilerOptions.WarningLevel, ruleSetFileGeneralDiagnosticOption) 73Dim specificDiagnosticOptions As IReadOnlyDictionary(Of String, ReportDiagnostic) = DetermineSpecificDiagnosticOptions(compilerOptions, ruleSetFileSpecificDiagnosticOptions) 251Private Shared Function DetermineGeneralDiagnosticOption(level As WarningLevel, ruleSetGeneralDiagnosticOption As ReportDiagnostic?) As ReportDiagnostic 262Private Shared Function DetermineSpecificDiagnosticOptions(options As VBCompilerOptions, ruleSetSpecificDiagnosticOptions As IDictionary(Of String, ReportDiagnostic)) As IReadOnlyDictionary(Of String, ReportDiagnostic) 264ruleSetSpecificDiagnosticOptions = New Dictionary(Of String, ReportDiagnostic) 268Dim diagnosticOptions = New Dictionary(Of String, ReportDiagnostic)(ruleSetSpecificDiagnosticOptions) 273If pair.Value = ReportDiagnostic.Warn Then 274diagnosticOptions(pair.Key) = ReportDiagnostic.Error 280If pair.Value <> ReportDiagnostic.Error Then 281diagnosticOptions(pair.Key) = ReportDiagnostic.Suppress 288diagnosticOptions(diagnosticID) = ReportDiagnostic.Error 292Dim ruleSetOption As ReportDiagnostic 296diagnosticOptions(diagnosticID) = ReportDiagnostic.Default 301diagnosticOptions(diagnosticID) = ReportDiagnostic.Suppress 304Return New ReadOnlyDictionary(Of String, ReportDiagnostic)(diagnosticOptions) 307Private Shared Function ConvertWarningLevel(level As WarningLevel) As ReportDiagnostic 310Return ReportDiagnostic.Suppress 313Return ReportDiagnostic.Default 316Return ReportDiagnostic.Error
Mvc.Api.Analyzers.Test (2)
ApiConventionAnalyzerIntegrationTest.cs (1)
313ReportDiagnostic.Info);
IgnoreCS1701WarningCodeFixRunner.cs (1)
14return options.WithSpecificDiagnosticOptions(new[] { "CS1701" }.ToDictionary(c => c, _ => ReportDiagnostic.Suppress));
System.Windows.Forms.Analyzers.CSharp.Tests (5)
Analyzers\Verifiers\CSharpVerifierHelper.cs (5)
16/// related to nullability mapped to <see cref="ReportDiagnostic.Error"/>, which is then used to enable all 19internal static ImmutableDictionary<string, ReportDiagnostic> NullableWarnings { get; } = GetNullableWarningsFromCompiler(); 21private static ImmutableDictionary<string, ReportDiagnostic> GetNullableWarningsFromCompiler() 29.SetItem("CS8632", ReportDiagnostic.Error) 30.SetItem("CS8669", ReportDiagnostic.Error);