I’m using SonarQube Developer 10.2.1.78527 deployed via Docker container, with SonarScanner 5.0.1.3006 and no other plugins/extensions.
I have a Rust project that I’m attempting to scan. The project is 90% Rust, and I’ve successfully scanned everything except for 10-ish C/C++ files that are included with the project. These files are primarily examples and SDKs. After reading SQ documentation, it appears that, regardless of which option I choose (build wrapper or compilation database), I need to build a C/C++ project with a C compiler.
I’m on an ARM Mac, so I need to use the compilation database option. Regardless, all instructions for both options reference using C compilers, when this project is built with Cargo.
Is there a way to scan C/C++ files like this that are part of a larger non-C/C++ project?
For a C/C++/Objective-C analysis to be accurate, the analyzer needs to understand how the code is meant to be compiled. Compilation options, like macro definitions and include directories, can have a huge impact on the generated code and consequently on the analysis results.
So compilation is required if you want to analyze these files, whether they’re the entire project or just a small subset of another project.
The CFamily plugin you have in your SQ version should provide a working build-wrapper for ARM Mac. Can you give it a try, and wrap the call to cargo build? Make sure you do a clean build.