Skip to content

Commit 9247ccc

Browse files
authored
Fix --severity-level (#1449)
1 parent 3dadfbf commit 9247ccc

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

ChangeLog.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Fixed
1111

1212
- [CLI] Fix loading of `slnf` files ([PR](https://github.com/dotnet/roslynator/pull/1447))
13+
- [CLI] Fix `--severity-level` ([PR](https://github.com/dotnet/roslynator/pull/1449))
1314

1415
## [4.12.1] - 2024-04-15
1516

src/Workspaces.Core/Diagnostics/CodeAnalyzer.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ private IEnumerable<Diagnostic> FilterDiagnostics(IEnumerable<Diagnostic> diagno
203203
{
204204
foreach (Diagnostic diagnostic in diagnostics)
205205
{
206-
if (diagnostic.IsEffective(Options, project.CompilationOptions, cancellationToken)
207-
&& (Options.ReportNotConfigurable || !diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.NotConfigurable)))
206+
if (diagnostic.IsEffective(Options, project.CompilationOptions, cancellationToken))
208207
{
209208
if (diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Compiler))
210209
{
@@ -222,7 +221,8 @@ private IEnumerable<Diagnostic> FilterDiagnostics(IEnumerable<Diagnostic> diagno
222221
}
223222
}
224223
}
225-
else
224+
else if (Options.ReportNotConfigurable
225+
|| !diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.NotConfigurable))
226226
{
227227
yield return diagnostic;
228228
}

src/Workspaces.Core/Extensions/Extensions.cs

-3
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,6 @@ public static bool IsEffective(
448448
if (!codeAnalysisOptions.IsSupportedDiagnosticId(diagnostic.Id))
449449
return false;
450450

451-
if (diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.Compiler))
452-
return true;
453-
454451
SyntaxTree? tree = diagnostic.Location.SourceTree;
455452

456453
ReportDiagnostic reportDiagnostic = diagnostic.Descriptor.GetEffectiveSeverity(tree, compilationOptions, cancellationToken);

0 commit comments

Comments
 (0)