Version
9.0.100-preview.7.24407.12+d672b8a0459b4888b3e9a6530646e61dd14941b2
Description
The report file created by passing --report indicates that changes should be grouped by file. This is supported by FileChanges being an array. This array consistently only contains 1 item, however, even if the DocumentId matches.
Reproduction
- Create or open a C# project.
- Add the below code:
var foo = (int)0;
var bar = (int)0;
- Add the following rule to an
.editorconfig file (Cast is redundant):
dotnet_diagnostic.IDE0004.severity = warning
- Run
dotnet format --report report.json on the project containing the code.
Expected Behavior
The report collects all warnings from the offending file in its FileChanges property:
[
{
"DocumentId": {
"ProjectId": {
"Id": "c8ac1ffd-ad20-46fe-bf3c-48900b4c79e3"
},
"Id": "6960fa6a-fec1-4515-84c9-d8bd515c9a7d"
},
"FileName": "Program.cs",
"FilePath": "...\\Program.cs",
"FileChanges": [
{
"LineNumber": 1,
"CharNumber": 11,
"DiagnosticId": "IDE0004",
"FormatDescription": "warning IDE0004: Cast is redundant."
},
{
"LineNumber": 2,
"CharNumber": 11,
"DiagnosticId": "IDE0004",
"FormatDescription": "warning IDE0004: Cast is redundant."
}
]
}
]
Actual Behavior
Each warning is in its own entry and FileChanges only has 1 element at all times:
[
{
"DocumentId": {
"ProjectId": {
"Id": "c8ac1ffd-ad20-46fe-bf3c-48900b4c79e3"
},
"Id": "6960fa6a-fec1-4515-84c9-d8bd515c9a7d"
},
"FileName": "Program.cs",
"FilePath": "...\\Program.cs",
"FileChanges": [
{
"LineNumber": 1,
"CharNumber": 11,
"DiagnosticId": "IDE0004",
"FormatDescription": "warning IDE0004: Cast is redundant."
}
]
},
{
"DocumentId": {
"ProjectId": {
"Id": "c8ac1ffd-ad20-46fe-bf3c-48900b4c79e3"
},
"Id": "6960fa6a-fec1-4515-84c9-d8bd515c9a7d"
},
"FileName": "Program.cs",
"FilePath": "...\\Program.cs",
"FileChanges": [
{
"LineNumber": 2,
"CharNumber": 11,
"DiagnosticId": "IDE0004",
"FormatDescription": "warning IDE0004: Cast is redundant."
}
]
}
]
Version
9.0.100-preview.7.24407.12+d672b8a0459b4888b3e9a6530646e61dd14941b2
Description
The report file created by passing
--reportindicates that changes should be grouped by file. This is supported byFileChangesbeing an array. This array consistently only contains 1 item, however, even if theDocumentIdmatches.Reproduction
.editorconfigfile (Cast is redundant):dotnet format --report report.jsonon the project containing the code.Expected Behavior
The report collects all warnings from the offending file in its
FileChangesproperty:[ { "DocumentId": { "ProjectId": { "Id": "c8ac1ffd-ad20-46fe-bf3c-48900b4c79e3" }, "Id": "6960fa6a-fec1-4515-84c9-d8bd515c9a7d" }, "FileName": "Program.cs", "FilePath": "...\\Program.cs", "FileChanges": [ { "LineNumber": 1, "CharNumber": 11, "DiagnosticId": "IDE0004", "FormatDescription": "warning IDE0004: Cast is redundant." }, { "LineNumber": 2, "CharNumber": 11, "DiagnosticId": "IDE0004", "FormatDescription": "warning IDE0004: Cast is redundant." } ] } ]Actual Behavior
Each warning is in its own entry and
FileChangesonly has 1 element at all times:[ { "DocumentId": { "ProjectId": { "Id": "c8ac1ffd-ad20-46fe-bf3c-48900b4c79e3" }, "Id": "6960fa6a-fec1-4515-84c9-d8bd515c9a7d" }, "FileName": "Program.cs", "FilePath": "...\\Program.cs", "FileChanges": [ { "LineNumber": 1, "CharNumber": 11, "DiagnosticId": "IDE0004", "FormatDescription": "warning IDE0004: Cast is redundant." } ] }, { "DocumentId": { "ProjectId": { "Id": "c8ac1ffd-ad20-46fe-bf3c-48900b4c79e3" }, "Id": "6960fa6a-fec1-4515-84c9-d8bd515c9a7d" }, "FileName": "Program.cs", "FilePath": "...\\Program.cs", "FileChanges": [ { "LineNumber": 2, "CharNumber": 11, "DiagnosticId": "IDE0004", "FormatDescription": "warning IDE0004: Cast is redundant." } ] } ]