date: 2017-05-07 title: CodeScan IntelliJ Plugin linktitle: IntelliJ weight: 21 description: Use CodeScan from IntelliJ to get fast feedback on required code changes menu: ide: parent: tutorials layout: ide — –>
CodeScan for IntelliJ
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 but please NOTE that currently the CodeScan IntelliJ Plugin WILL NOT WORK ALONG SIDE THE SONAR LINT INSTALLATION - you must uninstall SonarLint.
Installation
You will need:
- a working SonarQube (6.7.4+) installation
- a licensed CodeScan (4.0.7+) plugin to get started (see here)
Install CodeScan for IntelliJ
- Download CodeScan for IntelliJ Version from the downloads page
- Navigate to the Configuration > Plugins menu from the IntelliJ start screen.
- Click “Install plugin from disk”, select the .zip file you downloaded and click “OK”.
- Restart IntelliJ for the changes to take effect.
Setup Connected Mode
- With Connected Mode - the rule profiles used on the ‘bound’ server are used in IntelliJ.
- In IntelliJ, go to File > Settings > Other Settings. Open the ‘CodeScan General Settings.
- Click the green “+” sign to the right of the SonarQube Servers window to configure a new connection.
- For CodeScan Cloud
- Name your configuration and click Next
- Click Create Token and you will be taken to the appropriate page on your Cloud account
- Copy the token into the field, click Next and wait for IntelliJ to verify the connection
- Choose the organization you want to connect to and click Next. If there is only one organization associated with your user this will be done automatically.
- Click Finish
For Self-Hosted CodeScan
- Enter the URL of your SonarQube server (default is http://localhost:9000)
- Name your configuration and click Next
- Choose either Token or Login / Password
- If using a Token,
- Click Create Token and you will be taken to the appropriate page on your SonarQube server
- Copy the token into the field, click Next
- If using Login / Password
- Enter your SonarQUbe Login and Password (default is login:admin password:admin)
- Click Next
Click “Finish”.
Binding Projects
- Each IntelliJ project needs to ‘bound’ to a SonarQube project.
- In File > Settings > Other Settings, open CodeScan Project Settings.
- Ensure “Enable binding to remote SonarQube server” is checked and select the name of the connection you just made from the “Bind to server” dropbox.
Select your SonarQube project, the settings and Quality Profile from this project will be used.
Click on “OK” to persist the binding.
Refreshing configuration
If you need to refresh the local configuration (to retrieve new Quality Profiles and rules), you will need to go back to File > Settings > Other Settings > SonarLint General Settings and use the “Update Binding” action.
That’s it, you can now code and see CodeScan reporting issues based on remote SonarQube configuration.
Troubleshooting
You can check for any errors here by going to View > Tool Windows > SonarLint to open the SonarLint console.