Sonarlint not showing analysis report for C++ files in Android Studio

  • enabled SonarLint 6.6.0.45106 Version.
  • I enabled the Analysis Log then i can see below comments.

Trigger: ACTION
[Action] 1 file(s) submitted
Configuring analysis with org.sonarlint.intellij.java.JavaAnalysisConfigurator
Analysing ‘ADKEMVDemo.cpp’…
Starting analysis with configuration:
[
baseDir: C:\VDE\Projects\V210_BitBucket\src
extraProperties: {sonar.java.target=15, sonar.java.source=15, sonar.java.libraries=C:\Java\jdk-15\lib\jrt-fs.jar, sonar.java.jdkHome=C:/Java/jdk-15, sonar.java.test.libraries=C:\Java\jdk-15\lib\jrt-fs.jar}
moduleKey: Module: ‘src’
excludedRules:
includedRules:
ruleParameters: {}
inputFiles: [
file:///C:/VDE/Projects/V210_BitBucket/v210/src/Demo.cpp (UTF-8)
]
]

Start analysis
Index files
Language of file ‘file:///C:/VDE/Projects/V210_BitBucket/v210/src/ADKEMVDemo.cpp’ is detected to be ‘C++’
1 file indexed
‘JavaSensor’ skipped because there is no related files in the current project
‘Kotlin Sensor’ skipped because there is no related files in the current project
Execute Sensor: Sonar Secrets Detection Sensor
Execute Sensor: HTML
‘XML Sensor’ skipped because there is no related files in the current project
‘PHP sensor’ skipped because there is no related files in the current project
‘Analyzer for “php.ini” files’ skipped because there is no related files in the current project
‘Ruby Sensor’ skipped because there is no related files in the current project
‘Python Sensor’ skipped because there is no related files in the current project
Done in 69ms

P.S.: use the #bug:fault sub-category if you’re hitting a specific crash/error , or the #bug:fp sub-category for rules-related behaviour

Hello @jssamsulmpm,

Welcome to the community!

C/C++ analysis is currently supported by SonarLint only in CLion. Supporting Android Studio for C/C++ is not in our roadmap. Is there a reason why you open a cpp file in Android Studio ? Are you developing with the NDK ?

1 Like

i noticied Android Studio Sonarlint suporting C/C++ that’s why, i am using Android Studio.
if CLion is recommended then i will check & update.

Hello @Damien_Urruty

Server started on 64120
Couldn’t get a connected engine to sync quality profiles: Project is not bound to a SonarQube project
Trigger: EDITOR_OPEN
[Editor open] 1 file(s) submitted
File ‘Adjust.cpp’ excluded: OCFile:Adjust.cpp not in project sources
0 entries removed from the store
Trigger: EDITOR_OPEN
[Editor open] 1 file(s) submitted
File ‘ADKDemo.cpp’ excluded: OCFile:ADKDemo.cpp not in project sources
Trigger: ACTION
[Action] 1 file(s) submitted

i checked with CLion getting above log

This is the important part in the logs. The file needs to be part of a project supported by CLion. You can find more details about supported project types here.

Hope this helped

i tried quit some but the same warning coming everytime.

still i am not understanding what it’s mean by .cpp not in project sources :frowning:

but you know, in sonarqube without doing anything it’s identify the bug , Analysis & reporting here it’s pain in my neck

New Project itself no bugs

I can see that there is a CMakeLists.txt file in this latest screenshot, could you check that the main.cpp file is declared in it ?

You should also make sure to reload the CMake project if you make any change to this CMakeLists.txt file. You can find more details here : CMakeLists.txt | CLion

If you still can’t see any issue, please activate debug traces and send us the logs

As you can see in this scrnshot,

  • mail.cpp added in makelist.
  • and in log it’s showing 0 issues.

LOG :
Analysing ‘main.cpp’…
Index files
1 file indexed
Skip analysis of file: C:/Users/Samsul/CLionProjects/untitled/main.cpp
Subprocess(es) done in 96ms
0 compilation units analyzed
Found 0 issues

Hello, thanks for reporting again. This trace is interesting:

Skip analysis of file: C:/Users/Samsul/CLionProjects/untitled/main.cpp

This is a different problem than what you faced before. To help us understand what happens could you:

  1. Make sure to reload the CMake project as mentioned earlier
  2. Activate all verbose logs (please see here for how to activate the 2 Analysis logs and Verbose output options)
  3. Close and re-open the file
  4. Send us the resulting logs here
  5. Open main.cpp then hit Shift Shift, then Show Compiler Info and share the result with us here

Trigger: ACTION
[Action] 1 file(s) submitted
Configuring analysis with org.sonarlint.intellij.clion.CFamilyAnalysisConfigurator
Analysing ‘main.cpp’…
Starting analysis with configuration:
[
baseDir: C:\Users\Samsul\CLionProjects\untitled
extraProperties: {sonar.cfamily.build-wrapper-content={“version”:0,“captures”:[{“compiler”:“clang”,“cwd”:“C:\Users\Samsul\CLionProjects\untitled\cmake-build-debug”,“executable”:“C:\Program Files\JetBrains\CLion 2021.3.4\bin\mingw\bin\g++.exe”,“properties”:{},“cmd”:[“C:\Program Files\JetBrains\CLion 2021.3.4\bin\mingw\bin\g++.exe”,“C:/Users/Samsul/CLionProjects/untitled/main.cpp”,"-g","-std=gnu++14"]}]}}
moduleKey: Module: ‘untitled’
excludedRules:
includedRules: [cpp:S5422, cpp:S5303, cpp:ParsingError, cpp:S5305, cpp:S6192, cpp:IdentifierLongerThan31, cpp:S6193, cpp:S1067, cpp:S4334, cpp:S990, cpp:OneStatementPerLine, cpp:S871, c:S978, c:S856, cpp:S5419, c:S855, cpp:S873, c:S854, cpp:S994, c:S853, cpp:S874, c:S851, cpp:S5311, cpp:S5312, cpp:S5313, cpp:S5316, cpp:S1750, c:S3715, c:S982, cpp:S1749, cpp:S5306, c:S989, cpp:S5307, c:S867, c:Union, cpp:S5309, c:S986, c:S864, c:S985, c:S984, c:OctalConstantAndSequence, cpp:PPDirectiveIndentation, c:PPDirectiveIndentation, cpp:S5523, cpp:S3222, cpp:ClassComplexity, c:FileLoc, cpp:PPIncludeCHeader, c:S1451, cpp:OctalConstantAndSequence, cpp:S1712, cpp:C99CommentUsage, cpp:S855, c:S835, cpp:S856, c:S834, cpp:S978, cpp:S5639, cpp:S853, cpp:S2806, cpp:S2807, c:S950, cpp:S854, cpp:S1291, cpp:S6183, cpp:S6184, c:S960, cpp:S982, cpp:TabCharacter, cpp:S3469, cpp:S867, c:S967, c:S845, cpp:S989, c:S966, cpp:S984, cpp:S985, cpp:S864, cpp:S986, cpp:FunctionComplexity, c:IncAndDecMixedWithOtherOperators, cpp:UsingDirective, c:LogicalExpressionOperands, cpp:S4136, c:S1749, cpp:S793, cpp:S3715, c:PPDefineOrUndefFromBlock, cpp:PPMacroName, cpp:S3719, cpp:S5356, cpp:S5357, cpp:S5358, cpp:S5359, cpp:FunctionSinglePointOfExit, c:CommentMixedStyles, c:S784, c:S1067, cpp:ElseIfWithoutElse, c:S2393, c:PPIncludeTime, cpp:SideEffectInSizeOf, cpp:S1642, c:C99CommentUsage, cpp:S892, cpp:S1878, cpp:PPIncludeCstdio, c:S990, c:GotoUsage, c:S1774, cpp:S890, c:S1772, cpp:LineLength, cpp:LogicalExpressionOperands, cpp:S5318, c:TabCharacter, cpp:S5319, c:S874, c:S873, cpp:FileLoc, cpp:S1773, cpp:S1774, cpp:S1771, cpp:S1772, c:S1878, c:S883, cpp:S784, c:S1642, c:FunctionSinglePointOfExit, c:PPErrorDirectiveReached, c:ContinueUsage, c:S1707, c:S1821, cpp:S3400, c:S1705, c:ParsingError, cpp:FileComplexity, c:S1151, cpp:S113, cpp:S1578, cpp:IncAndDecMixedWithOtherOperators, cpp:ClassName, cpp:S116, cpp:S117, cpp:S6007, cpp:PPIncludeStdio, cpp:S2324, cpp:S5270, c:S1259, c:S1142, cpp:S121, c:S3562, c:S100, cpp:S1227, c:S109, cpp:S802, cpp:S5946, cpp:PPDefineOrUndefFromBlock, cpp:S127, cpp:S920, c:PPIncludeSignal, c:S793, c:PPIncludeStdio, c:ElseIfWithoutElse, cpp:GlobalNamespaceMembers, c:SideEffectInSizeOf, c:S1291, cpp:PPStringifyAndPastingUsage, c:PPStringifyAndPastingUsage, cpp:SizeofSizeof, c:S2806, cpp:ContinueUsage, cpp:S1451, cpp:S6221, c:S5639, c:S3222, cpp:PPIncludeCtime, cpp:S100, cpp:S3628, cpp:S109, cpp:S106, cpp:CommentMixedStyles, cpp:S5981, c:S929, c:S926, c:S925, c:S1227, c:S1226, cpp:S1142, cpp:S3562, c:FileComplexity, cpp:GotoUsage, c:S2324, cpp:Union, cpp:S1259, cpp:S834, c:S813, cpp:S835, c:S810, c:S139, c:S138, c:S930, c:S5270, cpp:S831, cpp:S1270, cpp:S1271, cpp:S3698, c:S1578, cpp:S3696, cpp:S3574, cpp:S1032, cpp:S1151, cpp:S6166, cpp:S1704, cpp:S1705, cpp:S960, cpp:S1821, c:S3400, c:IdentifierLongerThan31, cpp:NamespaceName, cpp:S966, cpp:S845, cpp:S967, c:S943, cpp:S1708, cpp:S963, cpp:S1706, cpp:S1707, cpp:S925, cpp:S926, cpp:PPIncludeSignal, cpp:S2335, cpp:S1244, cpp:S1002, cpp:S3542, cpp:S3540, c:PPMacroName, c:S113, c:S2342, c:S1131, c:S2343, cpp:S811, cpp:S812, c:FunctionComplexity, cpp:S813, cpp:PPIncludeTime, c:S117, c:S116, c:OneStatementPerLine, cpp:S138, cpp:PPErrorDirectiveReached, cpp:S810, cpp:S139, cpp:S5298, cpp:S2343, cpp:S1013, cpp:S1131, cpp:S2342, cpp:S1250, c:S121, cpp:S3549, c:S2335, c:S1244, cpp:S943, cpp:S5966, c:S802, cpp:S945, c:S920, c:SizeofSizeof, c:S127, c:LineLength]
ruleParameters: {}
inputFiles: [
file:///C:/Users/Samsul/CLionProjects/untitled/main.cpp (UTF-8) [cpp]
]
]

Start analysis
Index files
Language of file ‘file:///C:/Users/Samsul/CLionProjects/untitled/main.cpp’ is set to ‘C++’
1 file indexed
Execute Sensor: Sonar Secrets Detection Sensor
Execute Sensor: CFamily
Probing compiler: [C:\Program Files\JetBrains\CLion 2021.3.4\bin\mingw\bin\g++.exe, -x, c++, --std, gnu++14, -v, -dM, -E, -]
stdout:

stderr:
Using built-in specs.
COLLECT_GCC=C:\Program Files\JetBrains\CLion 2021.3.4\bin\mingw\bin\g++.exe
Target: x86_64-w64-mingw32
Configured with: …/gcc-11.2.0/configure --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --build=x86_64-alpine-linux-musl --prefix=/win --enable-checking=release --enable-fully-dynamic-string --enable-languages=c,c++ --enable-libatomic --enable-libgomp --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --enable-seh-exceptions --enable-shared --enable-static --enable-threads=posix --enable-version-specific-runtime-libs --disable-bootstrap --disable-graphite --disable-libada --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-libquadmath --disable-lto --disable-nls --disable-multilib --disable-rpath --disable-symvers --disable-werror --disable-win32-registry --with-gnu-as --with-gnu-ld --with-system-libiconv --with-system-libz --with-gmp=/win/makedepends --with-mpfr=/win/makedepends --with-mpc=/win/makedepends
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.2.0 (GCC)
COLLECT_GCC_OPTIONS=’-std=gnu++14’ ‘-v’ ‘-dM’ ‘-E’ ‘-shared-libgcc’ ‘-mtune=generic’ ‘-march=x86-64’
C:/Program Files/JetBrains/CLion 2021.3.4/bin/mingw/bin/…/libexec/gcc/x86_64-w64-mingw32/11.2.0/cc1plus.exe -E -quiet -v -iprefix C:/Program Files/JetBrains/CLion 2021.3.4/bin/mingw/bin/…/lib/gcc/x86_64-w64-mingw32/11.2.0/ -D_REENTRANT - -mtune=generic -march=x86-64 -std=gnu++14 -dM -dumpbase -

Skip analysis of file: C:/Users/Samsul/CLionProjects/untitled/main.cpp
Subprocess(es) done in 145ms
0 compilation units analyzed
Done in 164ms

Processed 0 issues
Found 0 issues

CompilerInfo.txt (17.6 KB)

Hi @jssamsulmpm, thanks for the extra traces, that was useful!

We discovered a small glitch on our side with MinGW, we created this ticket to tackle the problem. We are already working on fixing it.

In the meantime you could use a workaround that helped with a similar problem.

Thanks for your help improving our products!