Check code formatting in SonarQube


(Michał Rymarczyk) #1

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


(G Ann Campbell) #2

Hi Mike,

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

 
Ann


(Michał Rymarczyk) #3

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


(Michael Düsterhus) #4

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.