Skip to main content

How to Set Up SonarQube in IntelliJ: A Step-by-Step Guide

SonarQube in IntelliJ:

(Looking for SonarLint then check here: How to install and execute Sonarlint)

Setting up SonarQube in IntelliJ can significantly enhance your code quality by identifying bugs and vulnerabilities. Follow these steps to integrate SonarQube with IntelliJ:

Step 1
  • Install SonarLint PluginOpen IntelliJ and navigate to Settings.
  • Go to Plugins > Marketplace.
  • Search for SonarLint, install it, and restart the IDE.
Step 2: Configure SonarLint


  • Click on SonarLint at the bottom left of IntelliJ.
  • Select Configure SonarLint.
  • In the popup, check the box for Bind project to SonarQube/SonarCloud and click on Configure the connection.


Step 3
  • Set Up the ConnectionIn the new popup, click the + icon to add a new connection.
  • If the + icon is not visible, go to File > Settings > New UI and disable it. Apply changes and restart the IDE.
  • Name your connection and select SonarQube.
  • Enter the SonarQube URL (e.g., https://sonar.prod.company.com) and click Next.



Step 4
  • Authenticate and Create TokenA popup will appear with a Create Token option. Click on it.
  • Authenticate on the redirected page and click Allow.
  • Return to IntelliJ.






Step 5: Finalize Configuration
  • Click Next and then OK.
  • In the popup, select the connection name you created.
  • Search for your project key in the list and add your repository name.
  • Click OK to complete the configuration.

Step 6
  • Analyze Code with SonarLintClick on any file in your repository.
  • Go to SonarLint > Analyze with SonarLint.
  • View the issues in the Report tab.
Step 7: 
  • Re-enable New UI (Optional)Go back to File > Settings > Appearance.
  • Enable New UI and restart the IDE.
By following these steps, you can effectively integrate SonarQube with IntelliJ and maintain high code quality in your projects.

Also check: 


Comments

Popular posts from this blog

How to implement JUnit 5 in Your Maven or Gradle Project: A Step-by-Step Guide for Java Testing

Unit Testing JUnit Learn how to integrate JUnit 5 in your Maven or Gradle project for efficient Java testing. This guide covers adding dependencies, creating test classes, writing test methods, and running tests in IntelliJ IDEA and Visual Studio Code to ensure robust and error-free code. Step 1: Create a Simple Java Application Create a simple Java application, for example, “Copilot Demo,” and select Maven or Gradle as the build system through IntelliJ IDEA or Visual Studio Code. Step 2: Add JUnit Dependency For Maven: Add the following dependency to your pom.xml file inside the <dependencies> tag: XML <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>5.11.2</version> <scope>test</scope> </dependency> For Gradle: Add the following dependencies to your build.gradle file: dependencies { testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.11.2' } Step ...

How to Implement JBoss Narayana with Spring Boot: Java 21 to Master Distributed Transactions, Ensure Data Consistency, and Reliable Transactions

Integrating JBoss Narayana with Spring Boot : A Comprehensive Guide for Java 21 to Master Distributed Transactions, Ensure Data Consistency, and Reliable Transactions. Overview JBoss Narayana is a transaction manager that supports distributed transactions. It is part of the JBoss suite of projects and ensures data consistency across multiple resources, such as databases and message queues, in a distributed system. Narayana is compliant with the Java Transaction API (JTA) and supports both XA and non-XA transactions. Key FeaturesDistributed Transactions :  Ensures data consistency across multiple resources. JTA Compliance: Implements the Java Transaction API. Recovery: Provides mechanisms for transaction recovery in case of failures. Integration: Easily integrates with various Java EE and Spring applications. Compatibility : Compatible with Java 21 and other modern Java stacks 1 2 . Steps to Integrate JBoss Narayana in a Spring Boot Project Step 1: Add Dependencies Add the necessary...