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?
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?
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?
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.
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,
Can you tell me name of the log file?
It is called build-wrapper.log
, and should be in /home/travis/build/dismine/Valentina_git/bw-outputs/
.
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?
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…
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.
Thank you, i will.
Hello, I seem to have the same issue with Sonar 7.6 Development Edition:
Is there anything I can do with it? Change some parameter somewhere maybe?
I believe this issue was fixed in new version. It now works for me without any changes.
Hi @pvyleta,
it has been fixed in version 6.1 with CPP-2065, please make sure you are using such version.
As I said, I am using version 7.6 - Are you suggesting I downgrade? Maybe I misunderstood the versions, but I assumed I am using a newer version.
st 10. 4. 2019 v 14:10 odesílatel Massimo Paladin via SonarSource Community sscommunity@discoursemail.com napsal:
Hi @pvyleta,
sorry for not being clear, I was referring to the version of the C/C++ analyzer, in SonarQube 7.6 you get sonar-cfamily-plugin-6.0.0.10816
by default (see extensions/plugins
folder in sonarqube folder), the issue has been fixed in sonar-cfamily-plugin-6.1.0.11021
which comes with SonarQube 7.7.
Ahhh! thanks for the clarification, now I get it. Will update the Sonar then.
st 10. 4. 2019 v 15:40 odesílatel Massimo Paladin via SonarSource Community sscommunity@discoursemail.com napsal: