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

Print DiagnosticIds in the Report Analyzer Format #51695

Closed
andrei-epure-sonarsource opened this issue Mar 5, 2021 · 3 comments · Fixed by #51696
Closed

Print DiagnosticIds in the Report Analyzer Format #51695

andrei-epure-sonarsource opened this issue Mar 5, 2021 · 3 comments · Fixed by #51696
Labels
Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@andrei-epure-sonarsource

Hello.

This new feature suggestion is related to the Report Analyzer Format, which can be obtained by running the build with the /v:d /p:reportanalyzer=true parameters.

In SonarSource, we often ask to our users to share verbose logs with /p:ReportAnalyzer to generate the report with time spent by each analyzer.

One problem we have is that in the output, the analyzer class name is written, and it's not easy to map this to the supported diagnosticId(s). When providing support, it is useful to know the diagnosticId(s), too.

We would like to ask if there is a recommended way to include the rule ID in the /p:ReportAnalyzer logs, or if it would be feasible to be done on the Roslyn side. We are aware the multiple DiagnosticIds can be assigned to an Analyzer, and this feature would need to handle this scenario as well.

ACTUAL:

  Time (s)    %   Analyzer
     1.352   87   SonarAnalyzer.CSharp, Version=8.19.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244
     0.110    7      SonarAnalyzer.Rules.CSharp.UnusedReturnValue
     0.039    2      SonarAnalyzer.Rules.CSharp.UnusedPrivateMember

EXPECTED:

  Time (s)    %   Analyzer
     1.352   87   SonarAnalyzer.CSharp, Version=8.19.0.0, Culture=neutral, PublicKeyToken=c5b62af9de6d7244
     0.110    7      SonarAnalyzer.Rules.CSharp.UnusedReturnValue (S3241)
     0.039    2      SonarAnalyzer.Rules.CSharp.UnusedPrivateMember (S1144, S4487)

In the above example, the analyzer UnusedReturnValue has only one diagnosticId, whereas the UnusedPrivateMember analyzer has two diagnosticIds.

Thanks.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 5, 2021
@Youssef1313
Copy link
Member

I opened a PR to add this. But not sure if the team will want to do this or not.

@jmarolf
Copy link
Contributor

jmarolf commented Mar 5, 2021

This seems like a good idea to me. @sharwell and @mavasani any objections?

@sharwell
Copy link
Member

sharwell commented Mar 5, 2021

any objections?

No, it's the primary annoyance with KirillOsenkov/MSBuildStructuredLog#452

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants