Background info:
- Operating system: Windows 11 Pro
- Visual Studio version: Microsoft Visual Studio Enterprise 2022 (64-bit) Version 17.6.5
- SonarLint plugin version: 7.8.0.88494
- Programming language you’re coding in: C++ 14 compiled with Visual Studio
- Is connected mode used: Yes
- Connected to SonarCloud or SonarQube (and which version): SonarQube Developer Edition Version 10.1 (build 73491)
And a thorough description of the problem / question:
We have a working pipeline of SonarQube running on an in-house server, providing Pull Request decorations into BitBucket, and the analysis is working nicely with our C++ project. However, now we would like to use SonarLint with Visual Studio on our developers’ workstations, but unfortunately our project configuration does not seem to be supported by SonarLint. Here’s what SonarLint prints in Visual Studio’s Output window when I open a file, and SonarLint attempts to analyze it:
[ThreadId 22] [DEBUG] [VCX:VcxRequestFactory] [Thread id: 22] Trying to create request for REDACTED_FILEPATH\REDACTED_FILENAME.cxx
[ThreadId 1] [DEBUG] [VCX:VcxRequestFactory] [Thread id: 1] Could not get the file configuration
[ThreadId 72] [DEBUG] [CompilationDatabaseLocator] Could not find project root directory
[ThreadId 22] [DEBUG] [ExclusionSettingsStorage] File content: {
"sonar.exclusions": [],
"sonar.global.exclusions": [],
"sonar.inclusions": []
}
[ThreadId 22] [DEBUG] [AnalyzableFileIndicator]
Server Exclusions:
Inclusions:
Exclusions:
Global Exclusions:
file: 'REDACTED_FILEPATH\REDACTED_FILENAME.cxx'
should analyze: True
[ThreadId 22] [SecretsAnalyzer] Analyzing REDACTED_FILEPATH\REDACTED_FILENAME.cxx
[ThreadId 22] Loaded settings from "REDACTED_FILEPATH\AppData\Roaming\SonarLint for Visual Studio\Bindings\REDACTED_SOLUTION_NAME\secrets_settings.json".
[ThreadId 22] [RuleSettings] Using connected mode settings. User-specified settings in settings.json will be ignored.
[ThreadId 22] [SecretsAnalyzer] Finished analyzing REDACTED_FILEPATH\REDACTED_FILENAME.cxx, analysis time: 0.047s
[ThreadId 22] [SecretsAnalyzer] Found 0 issue(s) for REDACTED_FILEPATH\REDACTED_FILENAME.cxx
[ThreadId 22] [DEBUG] [VCX:VcxRequestFactory] [Thread id: 22] Trying to create request for REDACTED_FILEPATH\REDACTED_FILENAME.cxx
[ThreadId 1] Project's "Configuration type" is not supported.
[ThreadId 1] [DEBUG] [VCX:VcxRequestFactory] [Thread id: 1] Could not get the file configuration
[ThreadId 90] [DEBUG] [CompilationDatabaseLocator] Could not find project root directory
[ThreadId 90] Unable to retrieve the configuration for file 'REDACTED_FILEPATH\REDACTED_FILENAME.cxx'.
Check the file is part of a supported project type in the current solution.
Thus we do not get any results from SonarLint. Our C++ project does NOT use CMake, and thus our build does not use a “compilation database” or “compile_commands.json” file. To try and circumvent this, we created a mock “compilation database” file for SonarLint to use. Unfortunately, this does not seem sufficient for SonarLint’s requirements. Looking through the SonarLint Visual Studio extension’s source code, it seems that only projects opened in “folder workspace mode” are supported, and this is not how our solution/project is set up.
We tried to see whether we could build the SonarLint extension from source, to modify the source code to skip the check for the “folder workspace mode”. However, is seems that it is no longer an option, due to problems with JFrog on your end (see possibly related forum post from this spring), preventing us from building SonarLint’s Visual Studio extension from the source code.
In summary, here’s what we would like to know:
- Is it possible to use SonarLint with a C++ project that does not use CMake?
- If not, how can we build SonarLint from source (to modify this part of its code) without access to your JFrog instance?
Thanks in advance!