Does SonarQube support alternative C++ keywords?

scanner
sonarcfamily

(Dismine) #1

Hello,

In my projects i used alternative C/C++ keyword ‘not’. To check my project i use github and travis. Recent builds start failing with errors use of undeclared identifier ‘not’. So, my question is does sonarqube support it?


(Loïc Joly) #2

It is supported, we even have a rule to detect them (https://rules.sonarsource.com/cpp/RSPEC-3659).

What version of the CFamily plug-in are you using? Could you send us a small program that reproduces the issue?


(Dismine) #4

Here is short part of log:

INFO: Scanner configuration file: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/travis/build/dismine/Valentina_git/sonar-project.properties
INFO: SonarQube Scanner 3.0.3.778
INFO: Java 1.8.0_151 Oracle Corporation (64-bit)
INFO: Linux 4.4.0-101-generic amd64
INFO: User cache: /home/travis/.sonar/cache
INFO: Publish mode
INFO: Load global settings
INFO: Load global settings (done) | time=722ms
INFO: Server id: BD367519-AWHW8ct9-T_TB3XqouNu
INFO: User cache: /home/travis/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=168ms
INFO: Load/download plugins (done) | time=42722ms
INFO: Loaded core extensions: branch-scanner
INFO: SonarQube server 7.5.0
INFO: Default locale: “en_US”, source code encoding: “UTF-8”
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=8ms
INFO: Load project branches
INFO: Load project branches (done) | time=157ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=129ms
INFO: Load branch configuration
INFO: Load branch configuration (done) | time=6ms
INFO: Load project repositories
INFO: Load project repositories (done) | time=2122ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=154ms
INFO: Load active rules
INFO: Load active rules (done) | time=3613ms
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=133ms
INFO: Project key: dismine:valentina
INFO: Project base dir: /home/travis/build/dismine/Valentina_git
INFO: ------------- Scan Valentina
INFO: Base dir: /home/travis/build/dismine/Valentina_git
INFO: Working dir: /home/travis/build/dismine/Valentina_git/.scannerwork
INFO: Source paths: src
INFO: Source encoding: UTF-8, default locale: en_US
WARN: Property ‘sonar.abap.file.suffixes’ is not declared as multi-values/property set but was read using ‘getStringArray’ method. The SonarQube plugin declaring this property should be updated.
INFO: Index files
INFO: Excluded sources:
INFO: **/ui_*.h
INFO: 1885 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: Quality profile for c: Sonar way
INFO: Quality profile for cpp: Sonar way
INFO: Quality profile for xml: Sonar way
INFO: Excluded sources for coverage:
INFO: */
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: 3 source files to be analyzed
INFO: 3/3 source files have been analyzed
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=180ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=23ms
INFO: Sensor XML Sensor [xml]
WARN: Metric ‘comment_lines_data’ is deprecated. Provided value is ignored.
INFO: Sensor XML Sensor [xml] (done) | time=3146ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=15ms
INFO: Sensor CFamily [cpp]
INFO: Using build-wrapper output: /home/travis/build/dismine/Valentina_git/bw-outputs/build-wrapper-dump.json
INFO: Available processors: 2
INFO: Using 1 thread for analysis according to value of “sonar.cfamily.threads” property.
WARN: Invalid character encountered in file /home/travis/build/dismine/Valentina_git/src/libs/vmisc/literals.cpp at line 37 for encoding UTF-8. Please fix file content or configure the encoding to be used using property ‘sonar.sourceEncoding’.
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparser.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/vproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/vpropertydelegate.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/vpropertyfactorymanager.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/vpropertyformview.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/vpropertyformwidget.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparsertokenreader.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/vpropertymodel.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/vpropertyset.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/vpropertytreeview.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparsererror.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/vserializedproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparsercallback.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparserbytecode.cpp
ERROR: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparserbytecode.cpp:174 use of undeclared identifier ‘not’
ERROR: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparserbytecode.cpp:350 use of undeclared identifier ‘not’
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vwidgetproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vemptyproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vboolproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vshortcutproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vcolorproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparserbase.cpp
ERROR: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparserbase.cpp:895 use of undeclared identifier ‘not’
ERROR: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparserbase.cpp:1024 use of undeclared identifier ‘not’
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vshortcutpropertyeditor.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/venumproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vfileproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vcolorpropertyeditor.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vfilepropertyeditor.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vnumberproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/Vector3d/vvector3dproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/vstandardpropertyfactory.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vstringproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vpointfproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparsertest.cpp
ERROR: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparsertest.cpp:1366 unknown type name ‘not’
ERROR: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparsertest.cpp:1366 variable declaration in condition cannot have a parenthesized initializer
ERROR: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparsertest.cpp:1417 unknown type name ‘not’
ERROR: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparsertest.cpp:1417 expected ‘)’
ERROR: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparsertest.cpp:1440 unknown type name ‘not’
ERROR: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmuparsertest.cpp:1440 variable declaration in condition cannot have a parenthesized initializer
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vobjectproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vlinetypeproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vlinecolorproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/checkablemessagebox.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/vpropertyexplorer/…/…/…/…/src/libs/vpropertyexplorer/plugins/vlabelproperty.cpp
INFO: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmutranslation.cpp
ERROR: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmutranslation.cpp:90 unknown type name ‘not’
ERROR: [pool-4-thread-1] /home/travis/build/dismine/Valentina_git/build/src/libs/qmuparser/…/…/…/…/src/libs/qmuparser/qmutranslation.cpp:90 variable declaration in condition must have an initializer

Hope this will be helpful.


(Loïc Joly) #6

Hello @dismine,

To better understand what happens, could you send us the build wrapper file /home/travis/build/dismine/Valentina_git/bw-outputs/build-wrapper-dump.json as well as the log file that is in the same folder?

Thank you,


(Dismine) #7

Can you tell me name of the log file?


(Loïc Joly) #8

It is called build-wrapper.log, and should be in /home/travis/build/dismine/Valentina_git/bw-outputs/.


(Dismine) #9

Unfortunately i cannot get files. Since this is travis build i must wait sonar-scanner correct finish or fail. For some reasons sonar-scanner builds my code so long that whole build job exceeds the maximum time limit for jobs.

Does sonar-scanner have fast fail option?


(Loïc Joly) #10

Maybe in your build script you can deactivate the sonar-scanner part to just keep the generation of the build-wrapper.log file?

I’m not sure what you mean by fail fast… But at the end, if the analysis takes longer than what travis allows you, I’m afraid you’ll have to select a more scalable build system…


(Loïc Joly) #11

Hello again,

We found the cause of the issue you are encountering with alternative keywords. The analyzer understands them, but this is controlled by an option that is not correctly set currently. I created a ticket that you can follow to know when it will be corrected.


(Dismine) #12

Thank you, i will.