Is there a way to suppress the warning of a specific rule in a line of c code

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    sonarqube enterprise 10.2
  • how is SonarQube deployed: zip, Docker, Helm
    zip
  • what are you trying to achieve
    supress warnings in c code
  • what have you tried so far to achieve this
    I know NOSONAR is work well。

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hello!

Is there a way to suppress the warning of a specific rule in a line of c code? NOSONAR suppresses all warnings on a line of code, but I only want to suppress one of them. Just like @SuppressWarning does in java code

Hi,

Your best option is to simply mark the issue Won’t Fix directly in the UI.

 
Ann

Hi Ann,
For some reason, my repository is not fully compliant with the git specification. This caused me to have to mark on each branch not to fix. If I could suppress these reports by rule, I would only need to suppress these problems in the trunk branch, which would greatly reduce the developer’s workload.

Hi,

Issue status is only synched across branches at branch creation. There’s no ongoing relationship after that.

And I’ll flag this for the Product Managers so they’re aware of the need.

 
Ann

Hello Jiuwang,

Thank you for your feedback.

Can you provide more details or explanation about the sentence you mentioned: “My repository is not fully compliant with the git specification”?

Hi,
Our code repository is on svn, we introduce Google’s gerrit to conduct code review, and the code inspection is also to check the branch code of gerrit. We upload the svn code to gerrit through the tool git-svn to create the branch, and then the developer submits the new code to gerrit and carries out sonarqube check, and the code is merged and then synchronized to svn. In this way, the branches on svn retain the inheritance relationship, but the branches on gerrit are all separated from the master branch. Each code repository (project) will have three main branches. If there is a rule-based suppression mechanism, then the issue is directly suppressed when svn creates a new branch.