Check code formatting in SonarQube

(Michał Rymarczyk) #1


We want to use sonar to verify code formatting. We use Google Java Style Guide 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.


(Michał Rymarczyk) #3

Hi Ann,

Thank’s for reply. Unfortunately our Java Style Convention is Google Java Style Guide not sonar style guide with little modifications and we want to check them with every commit.


(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.