Check code formatting in SonarQube

Hi,

We want to use sonar to verify code formatting. We use Google Java Style Guide http://google.github.io/styleguide/javaguide.html with little modifications and we want to verify our’s code according to it. Maybe you can help us with solution.

Best Regards,
Mike Rymarczyk

1 Like

Hi Mike,

Take a look at the rules tagged ‘convention’. They should get you started.

 
Ann

Hi Ann,

Thank’s for reply. Unfortunately our Java Style Convention is Google Java Style Guide not sonar style guide https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml with little modifications and we want to check them with every commit.

Mike

You can import the checkstyle xml in sonar if you create a new java quality profile. The import is a bit buggy so you may have to stripdown the checkstyle xml until it works.

Additionally you should run the maven checkstyle plugin during CI build.