SonarLint Whitelisting errors or Marking False Positives

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarLint 4.1

  • what are you trying to achieve
    I’m trying to ignore an instance of a SonarLint error (not the whole rule) or whitelist a certain line without having to use the NOSONAR comment.

  • what have you tried so far to achieve this
    There is a “Delete” option when I right click an error in the SonarLint Report. Does this action ignore it, because when you delete the entry it warns you that the deleted marker could be recreated by a build or may not be recoverable?

Hello Jerry, thank you for your feedback.

I assume that you are using SonarLint for Eclipse 4.1, which as far as I know is the only flavor of SonarLint where this “Delete” action is shown. As described in the message that you mention, it only makes the marker temporarily disappear from the view; and since this suppression information is not persisted anywhere, a new analysis might make it come back.

This is a known limitation of current versions of SonarLint: suppression of individual issues is only supported either through code modifications (// NOSONAR and/or @SuppressWarnings), or in connected mode with SonarQube or SonarCloud; in this case, issues marked as “false positive” or “won’t fix” on server side will also disappear in your IDE.

Note that there is an ongoing discussion about the issue suppression UX across our products, so this situation might evolve in the mid- to long term.