Custom Quality Profiles in SonarQube — Part 1

Melih Gultekin
lTunes Tribe
Published in
2 min readMay 3, 2018

My first “Hello World” Medium Post folk!:) So in my very first post I chose to write about Custom Profiles because I haven’t encountered much articles about this and it is really helping me to write much cleaner code and even learn new things about Java :) This article will be a part of my “SonarQube” series: So let’s begin…

  • Firstly we need to download latest SonarQube.
  • After download, let’s start server by running `./sonar.sh start` command, if you are using Unix-like system. (This script can be found under {wherever_you_download_sonarqube}/bin/{operating_system_name})
  • Now, your SonarQube should be running at most likely http://localhost:9000/
  • To be able to create a custom profile we need to be an administrator. Check here for default admin credentials.
  • After successful login, we should better go “Administration>Marketplace” and install necessary features. I have installed SonarJava, Android, FindBugs, CheckStyle, Rules Compliance Index (it gives an info about what percentage your code complying). You can read more info at the Marketplace page.
  • At last, we are ready for my main aim to write this post, Custom Profiles!! 🎊

Creating Custom Quality Profile in SonarQube

Firstly, you may ask why we need a custom profile. Well there are some rules we, as developers, want to ignore but seeing these rules in the list doesn’t make us happy or even opposite, we want add a rule which does not exist in default rules. Let’s click Quality Profiles tab, go to the Java section, copy Sonar way profile and rename this Custom Quality Profile. You can either assign this profile to an existing project or even declare it as default for all projects.

Copied Sonar Way as My Sonar Way

To be able to remove or add some rules click “Activate More” button and Blimey! As we can see at below image, we can now activate or deactivate or even customize these rules.

deactivating or activating a rule in custom profile

At Part 2, I will try to explain how to use custom profiles on an Android Project. So try to keep up with me and don’t miss it ;) Any feedback for improvement, problems will be much appreciated by me. :)) Hope to see you soon.

--

--

Melih Gultekin
lTunes Tribe

Android Developer, Clean Code follower, Open Source Lover, Freelancer