src\roslyn\src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs (10)
90protected bool ShouldSkipAnalysis(SemanticModelAnalysisContext context, NotificationOption2? notification)
93protected bool ShouldSkipAnalysis(SyntaxNodeAnalysisContext context, NotificationOption2? notification)
96protected bool ShouldSkipAnalysis(SyntaxTreeAnalysisContext context, CompilationOptions compilationOptions, NotificationOption2? notification)
99protected bool ShouldSkipAnalysis(CodeBlockAnalysisContext context, NotificationOption2? notification)
102protected bool ShouldSkipAnalysis(OperationAnalysisContext context, NotificationOption2? notification)
105protected bool ShouldSkipAnalysis(OperationBlockAnalysisContext context, NotificationOption2? notification)
112NotificationOption2? notification,
120ImmutableArray<NotificationOption2> notifications,
134foreach (var notification in notifications)
150NotificationOption2? notification,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (16)
20arg, defaultValue.Notification, out var value, out var notification))
33arg, defaultValue.Notification, out var value, out var notification))
54=> TryGetCodeStyleValueAndOptionalNotification(arg, defaultNotification: NotificationOption2.None, out value, out _);
59/// in <paramref name="value"/> and <see cref="NotificationOption2.Error"/> will be returned
64string arg, NotificationOption2 defaultNotification, [NotNullWhen(true)] out string? value, [NotNullWhen(true)] out NotificationOption2 notification)
81if (TryParseNotification(arg.AsSpan(firstColonIndex + 1), out var localNotification))
96private static bool TryParseNotification(ReadOnlySpan<char> value, out NotificationOption2 notification)
101notification = NotificationOption2.None;
106notification = NotificationOption2.Silent;
109case EditorConfigSeverityStrings.Suggestion: notification = NotificationOption2.Suggestion; return true;
110case EditorConfigSeverityStrings.Warning: notification = NotificationOption2.Warning; return true;
111case EditorConfigSeverityStrings.Error: notification = NotificationOption2.Error; return true;
114notification = NotificationOption2.Silent;
156new(default, NotificationOption2.None);
174defaultCodeStyleOption.Notification, out var value, out var notification))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (15)
21NotificationOption2 Notification { get; }
23ICodeStyleOption2 WithNotification(NotificationOption2 notification);
33public static readonly CodeStyleOption2<bool> TrueWithSilentEnforcement = new(value: true, notification: NotificationOption2.Silent);
34public static readonly CodeStyleOption2<bool> FalseWithSilentEnforcement = new(value: false, notification: NotificationOption2.Silent);
35public static readonly CodeStyleOption2<bool> TrueWithSuggestionEnforcement = new(value: true, notification: NotificationOption2.Suggestion);
36public static readonly CodeStyleOption2<bool> FalseWithSuggestionEnforcement = new(value: false, notification: NotificationOption2.Suggestion);
41public static CodeStyleOption2<bool> GetCodeStyle(bool value, NotificationOption2 notification)
67internal sealed partial class CodeStyleOption2<T>(T value, NotificationOption2 notification) : ICodeStyleOption2, IEquatable<CodeStyleOption2<T>?>
69public static readonly CodeStyleOption2<T> Default = new(default!, NotificationOption2.Silent);
83public NotificationOption2 Notification { get; } = notification;
87ICodeStyleOption2 ICodeStyleOption2.WithNotification(NotificationOption2 notification) => new CodeStyleOption2<T>(Value, notification);
184DiagnosticSeverity.Hidden => NotificationOption2.Silent,
185DiagnosticSeverity.Info => NotificationOption2.Suggestion,
186DiagnosticSeverity.Warning => NotificationOption2.Warning,
187DiagnosticSeverity.Error => NotificationOption2.Error,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (12)
97defaultValue: new CodeStyleOption2<CollectionExpressionPreference>(CollectionExpressionPreference.WhenTypesLooselyMatch, NotificationOption2.Suggestion),
180defaultValue: new CodeStyleOption2<UnusedParametersPreference>(UnusedParametersPreference.AllMethods, NotificationOption2.Suggestion),
184if (CodeStyleHelpers.TryGetCodeStyleValueAndOptionalNotification(str, defaultValue.Notification, out var value, out var notification))
209defaultValue: new CodeStyleOption2<AccessibilityModifiersRequired>(SyntaxFormattingOptions.CommonDefaults.AccessibilityModifiersRequired, NotificationOption2.Silent),
213if (CodeStyleHelpers.TryGetCodeStyleValueAndOptionalNotification(str, defaultValue.Notification, out var value, out var notificationOpt))
259if (CodeStyleHelpers.TryGetCodeStyleValueAndOptionalNotification(str, defaultValue.Notification, out var value, out var notification))
275new(ParenthesesPreference.AlwaysForClarity, NotificationOption2.Silent);
294defaultValue: new(ParenthesesPreference.NeverIfUnnecessary, NotificationOption2.Silent),
307defaultValue: new CodeStyleOption2<ForEachExplicitCastInSourcePreference>(ForEachExplicitCastInSourcePreference.WhenStronglyTyped, NotificationOption2.Suggestion),
311if (CodeStyleHelpers.TryGetCodeStyleValueAndOptionalNotification(str, defaultValue.Notification, out var value, out var notification))
331defaultValue: new CodeStyleOption2<bool>(value: true, notification: NotificationOption2.Suggestion));
336defaultValue: new CodeStyleOption2<bool>(value: true, notification: NotificationOption2.Suggestion));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\VisualBasic\VisualBasicCodeStyleOptions.cs (3)
31"Dim,Const,WithEvents,Widening,Narrowing,Custom,Async,Iterator", NotificationOption2.Silent));
46defaultValue: new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.UnusedLocalVariable, NotificationOption2.Silent),
52defaultValue: new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.UnusedLocalVariable, NotificationOption2.Suggestion),
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs (1)
44NotificationOption2.Warning,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (3)
117private void ReportParameterArrayDiagnostic(OperationAnalysisContext context, SyntaxNode syntaxNode, ImmutableArray<IOperation> elements, NotificationOption2 notificationOption, ArrayCreationOperationLocation operationLocation)
129private void ReportArrayCreationDiagnostic(OperationAnalysisContext context, SyntaxNode syntaxNode, NotificationOption2 notificationOption)
137private void ReportDiagnostic(OperationAnalysisContext context, SyntaxNode syntaxNode, NotificationOption2 notificationOption, Location location, ArrayCreationOperationLocation operationLocation)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\CSharpCodeStyleOptions.cs (8)
96new(ExpressionBodyPreference.Never, NotificationOption2.Silent);
99new(ExpressionBodyPreference.Never, NotificationOption2.Suggestion);
102new(ExpressionBodyPreference.WhenPossible, NotificationOption2.Silent);
105new(ExpressionBodyPreference.WhenPossible, NotificationOption2.Suggestion);
108new(ExpressionBodyPreference.WhenOnSingleLine, NotificationOption2.Silent);
184defaultValue: new CodeStyleOption2<string>(string.Join(",", s_preferredModifierOrderDefault.Select(SyntaxFacts.GetText)), NotificationOption2.Silent));
241defaultValue: new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.DiscardVariable, NotificationOption2.Silent),
247defaultValue: new CodeStyleOption2<UnusedValuePreference>(UnusedValuePreference.DiscardVariable, NotificationOption2.Suggestion),