Install Free
Visual Studio | Using SonarQube for IDE | Fixing issues

Fixing issues

On this page

Whether your issue is about a potential security problem, considered to be a bad coding practice, or a more serious logic error, fixing issues usually involves changes to the code. SonarQube for IDE’s issue messages contain useful information about how to fix the potential problem and include a rule description so that you can learn more about why the issue is reported. 

SonarQube for Visual Studio offers multiple ways to Investigate issues and fix problems in your code. 

Quick fixes

When a file is open and there are issues with quick fixes then a lightbulb will appear on the line of the issue.

The appearance of a lightbulb will let you know that SonarLint found an issue.

If lightbulb is clicked a menu with possible quick fixes will be opened.

The SonarLint quick fix menu will pop up when you click on the lightbulb.

If one of the quick fixes is selected, the fix will be applied automatically to your code.

Known limitations for quick fixes

  • Quick fixes for the whole line are always shown #2878. To be explicit, the user is always shown quick fixes for all issues on the current line, rather than just for the current issue.  
  • When an edit elsewhere invalidates an issue, quick fixes are visible on the invalidated issue until a new analysis is run. When a new analysis is triggered, and the issue (with its subsequent quick fix) no longer exists, there is no quick fix to offer. 

Fixing injection vulnerabilities

Please see the documentation about Injection vulnerabilities for more information about working with these particular security issues.

Marking issues

In SonarQube for Visual Studio 7.5+ running in Connected mode with SonarQube (Server, Cloud) or SonarQube Community Build, it is possible to mark issues as Won’t Fix or False Positive from the IDE.

Select a SonarQube for Visual Studio issue in the Error window, right-click, and select Mark Issue as… from the list of actions.

Marking an issue can be applied only to known issues, issues found by SonarQube for Visual Studio that match those found on SonarQube (Server, Cloud) or SonarQube Community Build. Marks made on known issues will be reflected on the SonarQube (Server, Cloud) or SonarQube Community Build server within a few minutes.

At this time, it is not possible to unmark, or reopen an issue in SonarQube for Visual Studio. All issues must be reopened in SonarQube (Server, Cloud) or SonarQube Community Build, and will again show in SonarQube for Visual Studio after the next server synchronization. Please see the SonarQube Server, SonarQube Cloud, or SonarQube Community Build documentation on Issue lifecycles for more information.

Requirements for marking issues

  • SonarQube for Visual Studio 7.5.
  • Running in connected mode with SonarQube (Server, Cloud) or SonarQube Community Build. 
  • In SonarQube Server, or SonarQube Community Build, the Administer Issues permission must be granted to the user(s).

This feature is not supported for security hotspots or injection vulnerability. Please see the dedicated pages for fixing each of those issue types.


Was this page helpful?

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARQUBE, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License