How to configure CheckStyle and Findbugs plugins to IntelliJ IDEA

Sominda Gamage
4 min readFeb 3, 2020

--

I hope you are excited and eagerly waiting to write some really cool and interesting codes. But the sad story is that you’ll spend much more time over the course of your career maintaining code than you will be writing new code.

Yes, that’s the ugly truth. So, the quality of the codes is very important to us. Error-free code is like gold cus it would make our life much easier. Look at the guy in the meme. Do you want to be that guy? No right? One simple step to make our life easy is by integrating CheckStyle and Findbugs plugins to IntelliJ IDEA.

Installing CheckStyles

Well…. there are two ways that you can do this.

  1. Using the IDEA plugins menu
  2. Downloading the CheckStyle plugin manually and installing it.

Installing CheckStyles using the IDEA plugins menu

  1. If you are using a Mac, navigate to Preferences > Plugins. (Else navigate to File > Setting > Plugins).
  2. Type CheckStyle and install the latest plugin version.

3. After installing, restart the IDE to apply the changes.

Downloading the plugin manually and installing it

  1. Download the latest plugin which supports your IDE.
  2. Then navigate to Preferences > Plugins.
  3. Click on the gear icon on the top right-hand corner of the window and select Install Plugin from Disk.

4. After the installation, restart the IDE to apply the changes.

Ok, now you have successfully installed the CheckStyle plugin. Now is the time to configure it.

  1. Navigate to Preferences > Other Settings > CheckStyle.
  2. Select the CheckStyle version as 8.0 and hit Apply. (NOTE: If you select any other version higher than 8.0, there might be errors in the next step)

3. Now Click on the + icon.

4. Provide a suitable description, select Use a Checkstyle file accessible via HTTP and provide https://raw.githubusercontent.com/wso2/code-quality-tools/master/checkstyle/checkstyle.xml as the URL.

NOTE: If you run into any errors while doing so, the reason might be the version. Try changing the version to 7.1.2 and try again. If it didn’t work, MATE you are on your own, try googling and solve the issue.

5. Hit Next and again hit next until you meet the previous window.

6. Now select the new CheckStyle profile, hit Apply and finally hit Ok.

Alright, congratulations. Now you have configured CheckStyle. Now you can use it to find the issues in your code.

Installing Findbugs Plugin

The next step is to install Findbugs Plugin to find the bugs in your code.

  1. Download the Findbugs plugin.
  2. Then navigate to Preferences > Plugins.
  3. Click on the gear icon on the top right-hand corner of the window and select Install Plugin from Disk.
  4. After the installation, restart the IDE to apply the changes.
  5. Navigate to Preferences > Other Settings > FindBugs-IDEA.
  6. Navigate to the Report tab and configure the following.
Analysis effort: Maximal
Minimum confidence: Low

This will enhance the analyses by increasing precision and finding more bugs. Alright. Now you have successfully configured CheckStyle and FindBugs plugins for IntelliJ IDEA.

Folks I wrote this blog because someone else’s blog inspired me to do so. So… go read the blog by Jayanga Kaushalya. He is one good blogger.

--

--

No responses yet