Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLI] Include compiler diagnostics in the xml output file #964

Merged
merged 4 commits into from
Oct 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix formatting of argument list ([#952](https://github.com/josefpihrt/roslynator/pull/952).
- Do not remove async/await when 'using declaration' is used ([#953](https://github.com/josefpihrt/roslynator/pull/953).
- Convert if-else to return statement when pattern matching is used ([RCS1073](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1073.md)) ([#956](https://github.com/josefpihrt/roslynator/pull/956).
- [CLI] Include compiler diagnostics in the xml output file of the `roslynator analyze` command ([#964](https://github.com/JosefPihrt/Roslynator/pull/964) by @PeterKaszab).
- Do not simplify 'default' expression if the type is inferred ([RCS1244](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1244.md)) ([#966](https://github.com/josefpihrt/roslynator/pull/966).
- Use explicit type from lambda expression ([RCS1008](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1008.md)) ([#967](https://github.com/josefpihrt/roslynator/pull/967).

Expand Down
3 changes: 2 additions & 1 deletion src/CommandLine/Xml/DiagnosticXmlSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void Serialize(
XElement summary = CreateSummary(results.SelectMany(f => f.CompilerDiagnostics.Concat(f.Diagnostics)), formatProvider);

IEnumerable<XElement> projectElements = results
.Where(f => f.Diagnostics.Any())
.Where(f => f.Diagnostics.Any() || f.CompilerDiagnostics.Any())
.OrderBy(f => f.Project.FilePath, FileSystemHelpers.Comparer)
.Select(result => SerializeProjectAnalysisResult(result, formatProvider));

Expand All @@ -41,6 +41,7 @@ private static XElement SerializeProjectAnalysisResult(
new XElement(
"Diagnostics",
result.Diagnostics
.Concat(result.CompilerDiagnostics)
.OrderBy(f => f.LineSpan.Path)
.ThenBy(f => f.Descriptor.Id)
.ThenBy(f => f.LineSpan.StartLinePosition.Line)
Expand Down