Skip to content

Commit

Permalink
Avoid setting hasAnyCodeStyleOption for analyzers with no CodeStyleOp…
Browse files Browse the repository at this point in the history
…tion2<T>

Fixes #72162
Fixes #72876
  • Loading branch information
sharwell committed Apr 29, 2024
1 parent ea35f7c commit e929877
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected AbstractBuiltInCodeStyleDiagnosticAnalyzer(ImmutableDictionary<Diagnos
{
foreach (var (descriptor, option) in supportedDiagnosticsWithOptions)
{
Debug.Assert(option != null == descriptor.CustomTags.Contains(WellKnownDiagnosticTags.CustomSeverityConfigurable));
Debug.Assert(option is { Definition.DefaultValue: ICodeStyleOption } == descriptor.CustomTags.Contains(WellKnownDiagnosticTags.CustomSeverityConfigurable));
AddDiagnosticIdToOptionMapping(descriptor.Id, option);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal abstract class AbstractFileHeaderDiagnosticAnalyzer : AbstractBuiltInCo
private static readonly DiagnosticDescriptor s_missingHeaderDescriptor = CreateDescriptorForFileHeader(s_missingHeaderTitle, s_missingHeaderMessage);

private static DiagnosticDescriptor CreateDescriptorForFileHeader(LocalizableString title, LocalizableString message)
=> CreateDescriptorWithId(IDEDiagnosticIds.FileHeaderMismatch, EnforceOnBuildValues.FileHeaderMismatch, hasAnyCodeStyleOption: true, title, message);
=> CreateDescriptorWithId(IDEDiagnosticIds.FileHeaderMismatch, EnforceOnBuildValues.FileHeaderMismatch, hasAnyCodeStyleOption: false, title, message);

protected AbstractFileHeaderDiagnosticAnalyzer()
: base(ImmutableDictionary<DiagnosticDescriptor, IOption2>.Empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal abstract class AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer<TSynt
// ruleset editor or solution explorer. Setting messageFormat to empty string ensures that we won't display
// this diagnostic in the preview pane header.
private static readonly DiagnosticDescriptor s_fixableIdDescriptor = CreateDescriptorWithId(
RemoveUnnecessaryImportsConstants.DiagnosticFixableId, EnforceOnBuild.Never, hasAnyCodeStyleOption: true, "", "", isConfigurable: false);
RemoveUnnecessaryImportsConstants.DiagnosticFixableId, EnforceOnBuild.Never, hasAnyCodeStyleOption: false, "", "", isConfigurable: false);

#pragma warning disable RS0030 // Do not used banned APIs - Special diagnostic with 'Warning' default severity.
private static readonly DiagnosticDescriptor s_enableGenerateDocumentationFileIdDescriptor = new(
Expand Down

0 comments on commit e929877

Please sign in to comment.