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

S3992/S3904 - 1 violation reports ALL files in repo for violation #9659

Closed
dmstrat opened this issue Aug 30, 2024 · 5 comments
Closed

S3992/S3904 - 1 violation reports ALL files in repo for violation #9659

dmstrat opened this issue Aug 30, 2024 · 5 comments
Assignees
Labels
Type: UX Improve any kind of user experience

Comments

@dmstrat
Copy link

dmstrat commented Aug 30, 2024

Description

For Rule: S3992 - Provide a 'ComVisible' attribute for assembly 'srcassembly.dll'
For Rule: S2904 - Provide an 'AssemblyVersion' attribute for assembly 'srcassembly.dll'.

Problem: The violations are reporting against every single file in the repository.

Sonarqube (community edition and msbuild scanner used) reports 1 instance of the rule violation (both rules get one violation) reporting against the project such as ThisProject.dll
Codacy.com SonarC# reports over 18k violations which represents every single csharp file in the repository.
The violation also reports the assembly as 'srcassembly.dll' which may be a codacy.com implementation of the sonarC# as there are no projects in the repository named 'srcassembly'.

Repro steps

I'll try to take some time to generate a repro repo to share, but wanted to open the issue as I'm having the same problem with both rules.

Known workarounds

  • Turn off the rule in Codacy.com | Code Patterns | SonarC# until the rule is fixed
  • Figure out which project has the problem, fix it, and the 18k violations go away.

Related information

  • C#/VB.NET Plugins version - Codacy.com -> Code Patterns -> SonarC# 9.32 - codacy.com report
@Tim-Pohlmann
Copy link
Contributor

This seems to be a problem with Codacy.com. Please either contact them or clarify what behavior from the Sonar C# analyzer you find unexpected. Thank you!

@Tim-Pohlmann Tim-Pohlmann self-assigned this Sep 2, 2024
@dmstrat
Copy link
Author

dmstrat commented Sep 3, 2024

What I would expect of the behavior of the analyzer would be to report only the single violation for the project that needs this attribute, not every single file in the repository. Even though I agree that the srcassembly.dll in the message might be a Codacy issue I do not think the repeated violations are because of Codacy unless there is a configuration that would report this way. Is there such a way to configure the sonar scans to report against all files for these two rules, or these types of rules?

I would like to see something like this (which sonarqube does today):

violation
rule: S3992
message: Provide a 'ComVisible' attribute for assembly 'srcassembly.dll'
file: myProject.csproj

NOT something like this:

violation
rule: S3992
message: Provide a 'ComVisible' attribute for assembly 'srcassembly.dll'
file: myProject.csproj

violation
rule: S3992
message: Provide a 'ComVisible' attribute for assembly 'srcassembly.dll'
file: AssemblyInfo.cs

violation
rule: S3992
message: Provide a 'ComVisible' attribute for assembly 'srcassembly.dll'
file: Program.cs

violation
rule: S3992
message: Provide a 'ComVisible' attribute for assembly 'srcassembly.dll'
file: myClass.cs

... and 17,996 copies of this violation for each file in the repository.

@Tim-Pohlmann
Copy link
Contributor

The analyzer reports S3992 and S3904 per assembly, not per file; That is why SonarQube presents it this way. If Codacy.com displays the issue on every file, that likely stems from how they use the rule.

@Tim-Pohlmann Tim-Pohlmann added the Type: UX Improve any kind of user experience label Sep 9, 2024
@dmstrat
Copy link
Author

dmstrat commented Sep 17, 2024

Thank you for the feedback. If this is the case, then I would consider this closed for this project and take it to Codacy for correction.

@dmstrat dmstrat closed this as completed Sep 17, 2024
@Tim-Pohlmann
Copy link
Contributor

@dmstrat I'm glad I could help. If you need any more details to solve the issue end-to-end, let us know.

@Tim-Pohlmann Tim-Pohlmann closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: UX Improve any kind of user experience
Projects
None yet
Development

No branches or pull requests

2 participants