format
format copied to clipboard
IDE0073 not getting applied
We have found that "dotnet format" is not applying changes for the file_header_template value configured in the .editorconfig (rule IDE0073).
I've uploaded a small repo that demonstrates the issue: https://github.com/cabadam/TestIDE0073
From within Visual Studio, I can go to the top of the class file that is missing a header, and I do get the light bulb popping up where I can then select the IDE0073 item and direct it to fix all in solution. It then correctly identifies and changes the headers on the 2 appropriate files (the file with no header, and the file with the wrong header).
However, if I instead run the dotnet format command, no files are modified.
dotnet format --diagnostics IDE0073 TestIDE0073.sln --verbosity diagnostic
Output from the command is attached. dotnet-format-ide0073.txt
I wonder if your VS instance has a severity for this diagnostic which is set separately from the .editorconfig. If you add dotnet_diagnostic.IDE0073.severity = warning
to the .editorconfig, the files are fixed as expected. dotnet-format does not apply 'suggestions' when formatting unless you specify the lower --severity
in your args.
You appear to have nailed it - moving it up to warning in the .editorconfig made it apply as expected. A couple thoughts:
- The docs for --severity do not list "suggestion" as an option. It just lists options for error/info/warn. I tried giving both "suggestion" and "suggestions", but it rejected both.
- It would be outstanding if, when explicitly told to apply a specific rule, it TOLD me it was ignoring it anyway.
Hello. I stumbled upon this while looking for some file_header_template
related information.
It appears that this problem no longer exists?
IDE0073
is applied when running dotnet format --diagnostics IDE0073
.
The --severity
option lists info
as a possible argument, which applies suggestion
-level rules.