dotnet / dotnet/format

More detailed report messages

Open
#525 5 comments 1 reaction 0 assignees View on GitHub
Feature Request
Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Description

Given the following code:

```csharp
namespace ConsoleApp1
{
class Program {
static void Main(string[] args)
{
Console.WriteLine ("Hello World!");
}
}
}
```

Running `dotnet-format --dry-run` gives the following output:

```
Formatting code files in workspace 'C:\dev\xt0rted\actions-playground\Application.sln'.
src\ConsoleApp1\Program.cs(5,18): Fix whitespace formatting.
src\ConsoleApp1\Program.cs(8,30): Fix whitespace formatting.
Formatted code file 'Program.cs'.
Format complete in 4450ms.
```

The two violations have the same message of `Fix whitespace formatting` but there's no indication as to what the formatting issues are. The first error is `csharp_new_line_before_open_brace` and the second is `csharp_space_between_method_declaration_parameter_list_parentheses`.

At the very least the rule names should be included in the output, but more descriptive messages would be best. Knowing that the first issue is because there needs to be a new line before the brace, and the second issue is because there shouldn't be a space after the method declaration, is a lot more helpful then being told there's a generic whitespace issue.

Other linters such as ESLint and StyleLint produce a report in the [stylish format](https://eslint.org/docs/user-guide/formatters/#stylish) which has the rule name a violation message. The [compact format](https://eslint.org/docs/user-guide/formatters/#compact) is most similar to what's being used now though.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.