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

Log all formatter error messages in a csc-style #1016

Merged
merged 5 commits into from Mar 1, 2021

Conversation

JoeRobich
Copy link
Member

Resolves #953

Example msbuild output:

~/output-test> dotnet build /p:EnforceCodeStyleInBuild=true
Microsoft (R) Build Engine version 16.9.0-preview-21064-01+995458447 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored /Users/joeyrobichaud/output-test/output-test.csproj (in 95 ms).
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
/Users/joeyrobichaud/output-test/Test0.cs(10,13): warning CS0219: The variable 'count' is assigned but its value is never used [/Users/joeyrobichaud/output-test/output-test.csproj]
/Users/joeyrobichaud/output-test/Test0.cs(8,9): error IDE0007: use 'var' instead of explicit type [/Users/joeyrobichaud/output-test/output-test.csproj]
/Users/joeyrobichaud/output-test/Test0.cs(9,9): error IDE0007: use 'var' instead of explicit type [/Users/joeyrobichaud/output-test/output-test.csproj]
/Users/joeyrobichaud/output-test/Test0.cs(10,9): error IDE0007: use 'var' instead of explicit type [/Users/joeyrobichaud/output-test/output-test.csproj]

Build FAILED.

Example dotnet format diagnostic output

  The dotnet format version is '5.1.0-dev'.
  The dotnet runtime version is '6.0.0-alpha.1.21064.11'.
  The dotnet CLI version is '6.0.100-alpha.1.21065.7'.
  Using MSBuild.exe located in '/usr/local/share/dotnet/sdk/6.0.100-alpha.1.21065.7/'.
  Formatting code files in workspace '/Users/joeyrobichaud/output-test/output-test.csproj'.
  Loading workspace.
  Project output-test is using configuration from '/Users/joeyrobichaud/output-test/.editorconfig'.
  Project output-test is using configuration from '/Users/joeyrobichaud/output-test/obj/Debug/net5.0/output-test.GeneratedMSBuildEditorConfig.editorconfig'.
  Project output-test is using configuration from '/usr/local/share/dotnet/sdk/6.0.100-alpha.1.21065.7/Sdks/Microsoft.NET.Sdk/analyzers/build/config/AnalysisLevel_5_Default.editorconfig'.
  Complete in 3612ms.
  Determining formattable files.
  Complete in 388ms.
  Running formatters.
  Running Code Style analysis.
  Determining diagnostics...
  Running 4 analyzers on output-test.
/Users/joeyrobichaud/output-test/Test0.cs(8,9): error IDE0007: use 'var' instead of explicit type [/Users/joeyrobichaud/output-test/output-test.csproj]
/Users/joeyrobichaud/output-test/Test0.cs(9,9): error IDE0007: use 'var' instead of explicit type [/Users/joeyrobichaud/output-test/output-test.csproj]
/Users/joeyrobichaud/output-test/Test0.cs(10,9): error IDE0007: use 'var' instead of explicit type [/Users/joeyrobichaud/output-test/output-test.csproj]
/Users/joeyrobichaud/output-test/Test0.cs(10,13): warning CS0219: The variable 'count' is assigned but its value is never used [/Users/joeyrobichaud/output-test/output-test.csproj]
  Complete in 1891ms.
  Analysis complete in 1891ms.
  Complete in 2139ms.
  Formatted code file '/Users/joeyrobichaud/output-test/Test0.cs'.
  Formatted 1 of 4 files.
  Format complete in 6139ms.

Example dotnet format whitespace output

  The dotnet runtime version is '6.0.0-alpha.1.21064.11'.
  Using MSBuild.exe located in '/usr/local/share/dotnet/sdk/6.0.100-alpha.1.21065.7/'.
  Formatting code files in workspace '/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj'.
  Loading workspace.
  Project unformatted_project is using configuration from '/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/.editorconfig'.
  Project unformatted_project is using configuration from '/Users/joeyrobichaud/Source/format/.editorconfig'.
  Complete in 1947ms.
  Determining formattable files.
  Complete in 341ms.
  Running formatters.
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/other_items/OtherClass.cs(5,3): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/other_items/OtherClass.cs(6,3): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/other_items/OtherClass.cs(7,5): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/other_items/OtherClass.cs(8,5): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/other_items/OtherClass.cs(9,7): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/other_items/OtherClass.cs(10,5): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/other_items/OtherClass.cs(11,3): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/Program.cs(5,3): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/Program.cs(6,3): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/Program.cs(7,5): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/Program.cs(8,5): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/Program.cs(9,7): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/Program.cs(10,5): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/Program.cs(11,3): error WHITESPACE: Fix whitespace formatting. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/other_items/OtherClass.cs(12,2): error FINALNEWLINE: Fix final newline. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/Program.cs(12,2): error FINALNEWLINE: Fix final newline. [/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/unformatted_project.csproj]
  Complete in 384ms.
  Formatted code file '/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/other_items/OtherClass.cs'.
  Formatted code file '/Users/joeyrobichaud/Source/format/tests/projects/for_code_formatter/unformatted_project/Program.cs'.
  Formatted 2 of 6 files.
  Format complete in 2673ms.

@JoeRobich JoeRobich changed the title Diagnostic report format Log all formatter error messages in a csc-style Feb 26, 2021
@JoeRobich JoeRobich merged commit ff78edb into dotnet:master Mar 1, 2021
@JoeRobich JoeRobich deleted the diagnostic-report-format branch March 5, 2021 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write Analyzer warnings and errors to the output in the same format as CSC
2 participants