diff --git a/ChangeLog.md b/ChangeLog.md index 72761bcad1..c82e0c8b76 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix analyzer [RCS1246](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1246) ([PR](https://github.com/dotnet/roslynator/pull/1460)) - Fix analyzer [RCS1085](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1085) ([PR](https://github.com/dotnet/roslynator/pull/1461)) - Fix analyzer [RCS1077](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1077) ([PR](https://github.com/dotnet/roslynator/pull/1463)) +- [CLI] Fix `roslynator analyze --include/--exclude` ([PR](https://github.com/dotnet/roslynator/pull/1459)) ## [4.12.2] - 2024-04-23 diff --git a/src/Workspaces.Core/Diagnostics/CodeAnalyzer.cs b/src/Workspaces.Core/Diagnostics/CodeAnalyzer.cs index 88f9c9b329..e1d0af929f 100644 --- a/src/Workspaces.Core/Diagnostics/CodeAnalyzer.cs +++ b/src/Workspaces.Core/Diagnostics/CodeAnalyzer.cs @@ -224,7 +224,13 @@ private IEnumerable FilterDiagnostics(IEnumerable diagno else if (Options.ReportNotConfigurable || !diagnostic.Descriptor.CustomTags.Contains(WellKnownDiagnosticTags.NotConfigurable)) { - yield return diagnostic; + SyntaxTree? tree = diagnostic.Location.SourceTree; + + if (tree is null + || Options.FileSystemFilter?.IsMatch(tree.FilePath) != false) + { + yield return diagnostic; + } } } }