Install Sonar Lint Plug-in For Eclipse | CodeUsingJava

Install Sonar Lint Plug-in For Eclipse


In this session we will be having look at how to install sonar lint plug-in for our IDE Eclipse.
Before that let me tell you the difference between SonarLint and SonarQube
SonarLint
  • SonarLint is an agent that enables us to link and perform the analysis remotely with this SonarQube.
  • SonarLint can only be used as plug-in for IDE like IntelliJ, Eclipse, Visual Studio and Spring Tool Suite etc.
  • The aim is to provide instant feedback when you type in your script.
  • It focuses on what code you add or update for this.
SonarQube
  • SonarQube is a central database that conducts complete analyzes as it is triggered by different SonarQube scanners.
  • The aim is to provide a 360 ° view of your code base's performance.
  • For this, it regularly analyzes all of your project's source lines.

Both SonarLint and SonarQube depend on the same analyzers of the static source code, most of which are written using SonarSource technology.
Now let us look at the installation of SonarLint in our IDE. Here I am using Eclipse IDE
In order to install sonar lint plugin for Eclipse go to help click on eclipse market place

step1

You will see the below window

step2

Now type sonar lint click enter

step3

As you can see sonar lint click on install button

step4

Now select sonar lint and the click confirm

step5

Now you will be asked to approve the license so click on I accept the license agreement terms and click finish.

step6

It is trying to install and load all the jars and settings necessary to allow sonar to lint over the eclipse. It takes some time to install

step7
Eclipse needs a restart to show the sonar lint to the Eclipse Press restart now to reboot the Eclipse

step8

Here I have one default project in this workspace

step8.1

We need to enable sonar lint for this project. To enable right-click on the project and go to configure and you will see option as Enable SonarLint. Click on it

step9

Now we need to analyze source code in our project. Right click on project and go to sonar lint and click on option alanyze

step10

All the java files that are there in this project will be examined and it will show warning messages and errors

step11

If we closely have a look at messages it says that instead of system.out.println use logger. In the case of real time project it is always recommended that we use loggers like a log4j, instead of actually printing the output to the console hence it is giving you a warning message by saying that this is actually not the correct way to handle the code.
Using sonarlint development effort will be reduced and it will improve program that we are going to deliver to the clients so hope this concept is clear