Installing CodeScan for IntelliJ

Learning Objectives:

After completing this unit, you'll be able to:


Get Started with CodeScan IntelliJ plugin

The CodeScan IntelliJ plugin provides on-the-fly feedback to developers on bugs and quality issues, it is a fully-integrated user experience in the IntelliJ IDE.

The plugin is derived from SonarLint™.

Note:

CodeScan and IntelliJ plugin as of now will not work along with the SonarLint™ installation, so first you must uninstall SonarLint™.

Prerequisites

Make sure you have the following:

  • IntelliJ IDEA 2022.2 version or above

  • A CodeScan cloud account (with valid enterprise or trial license).

  • For CodeScan Self Hosted:

    • A working SonarQube™ (7.9+) installation

    • A licensed version of CodeScan (4.4+) plugin to get started (more info).

  • JDK version 11 or above

  • Latest available Node.js LTS version (v16 as of today)

  • Uninstall SonarLint™ Plugins. The CodeScan and IntelliJ plugin will not work alongside the SonarLint™ installation.


Install the CodeScan IntelliJ plugin

  1. Launch the IntelliJ IDEA app.

  2. Go to Plugins available on the navigation bar on the left side of the screen.

  3. Click on the Marketplace tab and search for CodeScan.

  4. Click on the Install button and wait for the installation to complete (click on Accept if prompted).

  5. Restart IntelliJ to save the changes.


Configuration Of CodeScan Plugin in IntelliJ

After successfully restarting the IntelliJ platform, you will require to configure the CodeScan plugin inside IntelliJ IDEA app.

  1. Select or double click on Tools and choose CodeScan in the dropdown.

Note:

Make sure you select the checkbox which says "Automatically trigger analysis".

  1. Click Next. It will now redirect you to another window where you need to enter your CodeScan token.

Note:

If you are a CodeScan Cloud user, selecting create token takes you directly to CodeScan Cloud window where you can generate the token. For more information on how to generate a new token for your account, refer to the article: Generate a Security Token

  1. Click Next after you enter the token.

  2. Once you choose the Organization, click on Next and then Finish.

Bind the project with CodeScan

  1. In Intellij IDEA app, go to File > Settings > CodeScan > Project settings.

  2. Select the Connection under the Project binding that you have just setup or choose from the existing one and the project you want to bind and analyze.

  3. Click on Apply, for the changes to take effect.

  4. You will now be able to see the errors under the CodeScan window at the bottom in the IDE if there are any, automatically, for the file which is open.


IntelliJ Troubleshooting

CodeScan Project binding updates gets failed

If the CodeScan update binding is getting failed, try disabling the VPN and antivirus, then try updating the binding again.

If the binding successfully updates, the error occurred due to antivirus blocking CodeScan. Add CodeScan to the list of allowed sites for the antivirus in use.

Point to Note:

“When Verbose output is enabled, sensitive data may be exposed and care needs to be taken when sharing the logs.”

Last updated