SonarOpenCommunity / sonar-cxx

SonarQube C++ Community plugin (cxx plugin): This plugin adds C++ support to SonarQube with the focus on integration of existing C++ tools.
GNU Lesser General Public License v3.0
988 stars 363 forks source link

C-Compiler Parser looks to be incorrectly specified as sonar.cxx.sonar.cxx.Visual C++ when GCC was selected. #1377

Closed RichardJack69 closed 6 years ago

RichardJack69 commented 6 years ago

Hi I'm a newby to sonar-cxx, we use gcc in our organisation. The plugine version is 0.9.8 I configured SonarQube in the Configuration tab Compiler Warnings->Format to use sonar.cxx.GCC. I also set the custom matcher to ^(.):([0-9]+):[0-9]+: warning: (.)\[(.*)\]$

When I run sonar-scanner I see this below result. Where it seems to think the parser is Visual C++ and fails?

07:48:25.354 INFO: Searching reports by relative path with basedir '/home/rjack/jats_cbuilder/rjack_wedge_proxy_1.1.60000.mbu_129232' and search prop 'sonar.cxx.compiler.reportPath' 07:48:25.354 DEBUG: Normalized report includes to '[/home/rjack/jats_cbuilder/rjack_wedge_proxy_1.1.60000.mbu_129232/compile_errs.txt]' 07:48:25.354 INFO: Scanner found '1' report files 07:48:25.354 INFO: Parser will parse '1' report files 07:48:25.354 INFO: Processing report '/home/rjack/jats_cbuilder/rjack_wedge_proxy_1.1.60000.mbu_129232/compile_errs.txt' 07:48:25.354 INFO: C-Compiler parser: 'sonar.cxx.sonar.cxx.Visual C++' 07:48:25.355 ERROR: Cannot feed the data into sonar, details: 'java.lang.NullPointerException' 07:48:25.355 INFO: Sensor c++ CompilerSensor [cxx] (done) | time=1ms

It also fails to pick up the warnings, I assume that might be related to the above. From the warnings file which has one entry. /home/rjack/jats_cbuilder/rjack_wedge_proxy_1.1.60000.mbu_129232/src/app/cli/cli.cpp:82:5: warning: converting to non-pointer type âintâ from NULL [-Wconversion-null]

Bertk commented 6 years ago

Please check issue #1359 which has more details for this bug. This bug is fixed with version 0.9.9 and you can use the property sonar.c.compiler.parser=GCC as a workaround. The default compiler is Visual C++. Please update your regular expression and use ^(.*):([0-9]+):[0-9]+: warning: (.*)\[(.*)\]$ This will extract the information from the warning message.

/home/rjack/jats_cbuilder/rjack_wedge_proxy_1.1.60000.mbu_129232/src/app/cli/cli.cpp:82:5: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]

1) /home/rjack/jats_cbuilder/rjack_wedge_proxy_1.1.60000.mbu_129232/src/app/cli/cli.cpp
2) 82
3) converting to non-pointer type 'int' from NULL 
4) -Wconversion-null
compiler-setting