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

US: NOSONAR support #1300

Closed
ociotec opened this issue Nov 13, 2017 · 7 comments · Fixed by #1758
Closed

US: NOSONAR support #1300

ociotec opened this issue Nov 13, 2017 · 7 comments · Fixed by #1758
Assignees
Milestone

Comments

@ociotec
Copy link

ociotec commented Nov 13, 2017

In JAVA analysis there is a way to ignore a warning in one class/method just adding a annotated value:

@java.lang.SuppressWarnings("squid:S00112")

It's also possible to add //NOSONAR comment in the line to ignore. This ignores all warnings for that line (too aggressive from my point of view).

Is there an equivalent supported way on sonar-cxx plugin?

If not, is it planned? (I already checked the issues list...).

Thanks in advance.

@guwirth
Copy link
Collaborator

guwirth commented Nov 13, 2017

@ociotec I'm sorry I never tried this out. For my understanding \\NOSONAR should work. Currently there is no other way planned.

I have different opinions to this. First of all I'm thinking that such comments are wasting the source code. On the other hand such comments are sometimes the only 'false positive' which are 'surviving' CI errors or SQ database updates.

@ociotec
Copy link
Author

ociotec commented Nov 13, 2017

@guwirth the issue is that I tried with //NOSONAR comment (in the line itself and in previous line) but it doesn't work.

I've tested with latest released plugin version (0.9.7).

@guwirth
Copy link
Collaborator

guwirth commented Nov 14, 2017

@ociotec think it's a little bit more complicated with our plugin. Typically you are importing reports from external tools were you have to use own annotations (e.g. cppcheck, ...). So there seems to be no one fits all?

@ociotec
Copy link
Author

ociotec commented Nov 14, 2017

@guwirth that's OK, for cppcheck warnings I use inline comments like this:

// cppcheck-suppress unusedFunction

For vera++ I use command line exclusions like this:

vera++ --exclusions vera++.exclusions ...

But my actual case is about cxx:MethodName rule, this seems to be generated by the plugin itself (maybe I'm wrong) so I don't know the way to disable it for a specific line code (or in any way).

I cannot disable it in SonarQube directly because we use branches (master, develop and one per feature), so there is a different project for each branch, so if we fix or marked as not fixed in one project branch, other branch projects will have the open issues...

Any solution or workaround?
Thanks in advance.

@guwirth
Copy link
Collaborator

guwirth commented Nov 14, 2017

@ociotec
Copy link
Author

ociotec commented Nov 14, 2017

@guwirth is there any chance to include it in next release?

It will be a great way to bypass a few controlled situations in the code that are not possible to fix.

@guwirth guwirth added this to the next milestone Nov 15, 2017
@guwirth
Copy link
Collaborator

guwirth commented Nov 15, 2017

@ociotec should be not too difficult. maybe someone has time to do it.

@guwirth guwirth removed this from the 0.9.9 milestone Nov 19, 2017
@guwirth guwirth changed the title Ignore specific warning in specific file US: NOSONAR support Jan 21, 2018
@guwirth guwirth modified the milestones: 1.1, 1.2 Jun 9, 2018
@guwirth guwirth removed this from the 1.2 milestone Oct 29, 2018
@guwirth guwirth added this to the 1.2.2 milestone Dec 23, 2018
@guwirth guwirth removed this from the 1.2.2 milestone Feb 9, 2019
@guwirth guwirth added this to the 1.3.1 milestone Aug 18, 2019
@guwirth guwirth self-assigned this Aug 30, 2019
@guwirth guwirth mentioned this issue Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants