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™.
Prerequisites
Make sure you have the following:
- IntelliJ IDEA 2022.2 version or above 
- CodeScan for the Cloud: - Valid enterprise license or trial (cloud trial only—not available with self-hosted) 
 
- For Self-Hosted (On-Premises) CodeScan: - A working SonarQube™ 9.9+ LTA installation 
- A licensed version of CodeScan 4.4+ plugin to get started (more info) (no trial available with self-hosted/on-premises CodeScan). 
 
- JDK version 17 or above 
- Latest available Node.js 20 LTS version 
- Uninstall SonarLint™ plug-ins. The CodeScan and IntelliJ plug-in will not work alongside the SonarLint™ installation. 
Install the CodeScan IntelliJ plugin
- Launch the IntelliJ IDEA app. 
- Go to - Pluginsavailable on the navigation bar on the left side of the screen.
- Click on the - Marketplacetab and search for- CodeScan.
- Click on the - Installbutton and wait for the installation to complete (click on- Acceptif prompted).
- 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.
- In the IntelliJ IDEA app, go to - Settings(- Preferenceson Mac).

- Select or double click on - Toolsand choose- CodeScanin the dropdown.
- You will see another - Settingstab under which you can see the (+) icon, click on it.

- A new popup window opens where you need to give the - Configuration Nameand choose the- Connection Typeof your preference. Choose the first option if you are using CodeScan cloud default (- https://app.codescan.io) instance, and second option if you are on a different CodeScan instance (other than- https://app.codescan.io) or server. For example, if you're using the CodeScan European instance with the CodeScan IntelliJ plugin, select the second option i.e.,- Connect to other CodeScan instances or serverand enter https://app-eu.codescan.io in the- CodeScan URLsection.

- Click - Next. It will now redirect you to another window where you need to enter your CodeScan token.
- Click - Nextafter you enter the token.
- A new window shows up where you can choose the - Organization(If you are part of multiple organizations) which you want to configure.

- Once you choose the - Organization, click on- Nextand then- Finish.
Bind the project with CodeScan
- In IntelliJ IDEA app, go to - File > Settings > CodeScan > Project settings.
- Select the checkbox which says - Bind the project with CodeScan/CodeScan Cloud.

- Select the - Connectionunder the- Project bindingthat you have just setup or choose from the existing one and the project you want to bind and analyze.
- Click on - Apply, for the changes to take effect.
- 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. 
- If the errors don't show up immediately, reopen the file and you will be able to see the changes. 

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.
If the binding still fails, raise a Support Ticket, including the analyzer logs and verbose logs in the attachment.

Last updated
Was this helpful?

