Handling Objective C++ source files (.mm extension)

157 views
Skip to first unread message

Yavuz Nuzumlalı

unread,
Feb 19, 2018, 4:19:39 PM2/19/18
to SonarQube
Hi,

I see that currently sonarqube does not analyze Objective C++ source files which have .mm extension. It can't assign a language for those files, and simply ignores them.

Because our code contains a mixture of C++ and Objective-C source files, we also have a plenty of .mm files which performs wrapping between languages.

Is there any ways to make sonarqube analyse those files also?

Best

Colin Mueller

unread,
Feb 19, 2018, 7:22:50 PM2/19/18
to SonarQube
At the project level you can set the sonar.objc.file.suffixes property. By default, it allows for .m, but you can add others (like .mm). See Administration > General Settings > C/ C++ /Objective-C, or include that it in a sonar-project.properties file if you're already using making use of one.

Colin  

Yavuz Nuzumlalı

unread,
Feb 20, 2018, 4:20:23 AM2/20/18
to SonarQube
That's great, thanks for help!

What about C++ codes existing inside .mm files? I guess if I set .mm to language suffixes, it will only run objc analysis on those files.

Is it possible to add same extension to multiple languages? If not, is there any other ways to make sonar able to analyse C++ parts of thoe .mm files?

Thanks for any help!

Colin Mueller

unread,
Feb 20, 2018, 12:12:47 PM2/20/18
to SonarQube
Yavuz,

I don't believe that's possible. As evidenced by analyzers like SonarPLSQL and SonarTSQL, if you have both plugins running on a sonarqube instance and allow .sql as a file suffix for both sonar.tsql.file.suffixes and sonar.plsql.file.suffixes, the analysis will error out when scanning .sql files. Only one language per file is allowed.

You could potentially create a seperate project for just those files (excluding them from analysis on the other project) and fiddle with the file suffix properties for the relevant languages, but I imagine that's not ideal.

Colin
Reply all
Reply to author
Forward
0 new messages