Skip to content

Integrating Codacy with Visual Studio Code#

The Codacy Visual Studio Code extension is an open-source project that enables developers to review directly in VS Code the result of Codacy analysis for the pull requests they’re working on.

Use this extension to get the full list of problems found by Codacy for a pull request and navigate to any Quality issue that you want to review and fix.

To use this extension you need a Codacy account

Installing the Codacy VS Code extension#

  1. Make sure that the repository you’re working on is analyzed by Codacy and that you have at least Repository Read permissions.

    Tip

    If this is your first time using Codacy, see how to add and analyze your first repository.

  2. Install the extension from the Visual Studio Marketplace or through the Extensions view in VS Code.

    Alternatively, you can install it manually by downloading the latest release as a VSIX package.

Getting pull request quality and coverage data#

To see Codacy quality and coverage data for the pull request you're working on, follow these steps:

  1. Open the repository directory in VS Code.

    Note

    If the repository isn't on Codacy yet, add it to Codacy first.

  2. Check out the branch associated with the open pull request you're working on.

  3. Open the main view by clicking the Codacy logo in the activity bar or the Codacy tab in the status bar.

    Codacy main view

  4. If you’re not signed in, click the Sign in button to authorize VS Code on Codacy.

After completing these steps, the main view shows the result of the latest Codacy analysis for the pull request. The VS Code Problems tab lists the Quality issues found.

Codacy main view

The main view displays the information about the code quality changes introduced by the pull request:

  • The Quality status of the pull request, either up to standards or not up to standards, based on the Quality gates set for the repository.

  • Any Quality issues introduced or fixed by the pull request. These are the same issues you find in the Quality Issues tabs in the Codacy app and are also visible in VS Code's Problems tab.

    The number next to each file name is the total number of Quality issues that the pull request adds to or removes from that file. The number farther to the right is the number of new Medium or Critical Quality issues. If there are any such issues, the file name is also highlighted in yellow (Medium) or red (Critical).

    Important issues

  • The diff coverage and coverage variation introduced by the pull request. These are the same values you find in the Pull request coverage overview panel in the Codacy app.

    The percentage next to each file name is the coverage variation for that file.

  • Sequences of duplicate code (clones). These are the same ones you find in the Quality Duplication tabs in the Codacy app.

  • Variations in code complexity.

Reviewing pull request issues#

In the Problems tab, Codacy displays the same Quality issues you find in the main view and lets you navigate to the exact line of code where the issue was found.

Note

Code coverage, duplicates, and complexity aren't currently shown in the Problems tab.

To review Quality issues:

  1. Open the Problems tab (use Ctrl+Shift+M on Windows/Linux or Cmd+Shift+M on macOS).

  2. Click the name of the issue you want to review.

    Navigate to a specific issue from the Problems tab

  3. Hover over a highlighted issue in the code editor to view available actions and suggested quick fixes (if available).

    For a list of tools that support quick fixes, see Supported languages and tools.

  4. Once you've addressed the problems in your code, push your changes to the Git provider so that Codacy analyzes the updated code.

When the analysis is complete, the Codacy extension automatically refreshes the pull request analysis result. You can also refresh the pull request data manually by clicking the Refresh Pull Request button in the main view.

See also#

Share your feedback 📢

Did this page help you?

Thanks for the feedback! Is there anything else you'd like to tell us about this page?

We're sorry to hear that. Please let us know what we can improve:

Alternatively, you can create a more detailed issue on our GitHub repository.

Thanks for helping improve the Codacy documentation.

Edit this page on GitHub if you notice something wrong or missing.

If you have a question or need help please contact support@codacy.com.

Last modified September 20, 2023