Does sonarlint support c++?

1,078 views
Skip to first unread message

Sergey Emantayev

unread,
Mar 16, 2017, 10:32:59 AM3/16/17
to SonarLint
Hello, 

I'm trying to run sonarlint (2.1.0.566) from command line in order to analyze the c++ code with no success. Same works pretty well in Eclipse with the sonarlint plugin. Also, I'm able to see the analysis results on our sonarqube server. I run following command: 

sonarlint --src "src/*.cpp" -X

I got following log:

DEBUG: Plugins:
DEBUG: * C / C++ / Objective-C 4.4.0.6266 (cpp)
DEBUG: * Python 1.6 (python)
DEBUG: * Java 4.4.0.8066 (java)
DEBUG: * PHP 2.9.1.1705 (php)
DEBUG: * JavaScript 2.19.0.3866 (javascript)
DEBUG: * PL/SQL 2.8 (plsql)
DEBUG: * Swift 2.0.0.1127 (swift)

This is good, it seems that we have a c++ plugin. The next lines are fine as well:

DEBUG: Available languages: 
DEBUG: * C => "c" 
DEBUG: * C++ => "cpp" 
DEBUG: * Objective-C => "objc" 
DEBUG: * Python => "py" 
DEBUG: * Java => "java" 
DEBUG: * PHP => "php" 
DEBUG: * JavaScript => "js" 
DEBUG: * PL/SQL => "plsql" 
DEBUG: * Swift => "swift"

Yet the following lines are confusing:

DEBUG: Start analysis 
DEBUG: Declared extensions of language C were converted to c: file:**/*.disabled 
DEBUG: Declared extensions of language C++ were converted to cpp: file:**/*.disabled 
DEBUG: Declared extensions of language Objective-C were converted to objc: file:**/*.disabled 
DEBUG: Declared extensions of language Python were converted to py: file:**/*.py 
DEBUG: Declared extensions of language Java were converted to java: file:**/*.java,file:**/*.jav 
DEBUG: Declared extensions of language PHP were converted to php: file:**/*.php,file:**/*.php3,file:**/*.php4,file:**/*.php5,file:**/*.phtml,file:**/*.inc 
DEBUG: Declared extensions of language JavaScript were converted to js: file:**/*.js 
DEBUG: Declared extensions of language PL/SQL were converted to plsql: file:**/*.sql,file:**/*.pks,file:**/*.pkb 
DEBUG: Declared extensions of language Swift were converted to swift: file:**/*.swift

...

INFO: 34 files indexed 
DEBUG: 'C' skipped because there is no related file in current project 
DEBUG: 'CPP' skipped because there is no related file in current project 
DEBUG: 'Objective-C' skipped because there is no related file in current project 
DEBUG: 'Python Squid Sensor' skipped because there is no related file in current project 
DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project 
DEBUG: 'PHP sensor' skipped because there is no related file in current project 
DEBUG: 'JavaScript Squid Sensor' skipped because there is no related file in current project 
DEBUG: 'PL/SQL Sensor' skipped because there is no related file in current project 
DEBUG: 'Swift Squid Sensor' skipped because there is no related file in current project

Why the c++ extensions are disabled? How can I enable it?

Duarte Meneses

unread,
Mar 16, 2017, 11:14:11 AM3/16/17
to Sergey Emantayev, SonarLint
Hi,

Running the cpp plugins in SonarLint requires additional configuration (with a build wrapper, which will generate all necessary compiler options and includes) and that's why it is disabled by default.
Currently it's only done in SonarLint Eclipse (with CDT). We don't expect to support it in SonarLint CLI, at least in the near future.
May I ask why you want to use the CLI when you have it working in Eclipse?




--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/fb2b0659-d5fa-4e6c-bf8f-562a0db2a3fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Duarte MENESES | SonarSource

Sergey Emantayev

unread,
Mar 19, 2017, 11:31:43 AM3/19/17
to SonarLint, sergey.e...@gmail.com
Actually, our team is happy with the C++ Eclipse plugin. What we are missing is a summary with the number of bugs/violations per source file. We are required to provide such a report as a proof of static analysis tool being ran before committing the code. So I thought about the CLI tool as an option. 

Is there any way to obtain the summary in Eclipse? I've checked the "SonarLint Report" tab, yet it shows no information. I use SonarLint plugin 2.6.0.201702201416 with Eclipse Neon.3 Release (4.6.3RC2).
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+...@googlegroups.com.

Duarte Meneses

unread,
Mar 20, 2017, 3:32:10 AM3/20/17
to Sergey Emantayev, SonarLint
It will be possible soon to analyze, in Eclipse, all files in the project even though it will probably still lack a way export the report: https://jira.sonarsource.com/browse/MMF-640

SonarQube seems to be more appropriate to achieve what you want. We see SonarLint as a personal tool for developers to control the issues that they introduce in the code. With SonarQube it's easy for anyone in the team to see the status of each project, including the historical evolution.

To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/0bbde998-8182-48ee-b92e-eb01f40d628b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Sergey Emantayev

unread,
Mar 20, 2017, 6:53:40 AM3/20/17
to SonarLint, sergey.e...@gmail.com
Great news :) Thank you for the update! Which Sonarlint version will this feature be available in?

I agree with you about SonarQube. However, as a relatively large team of developers we prefer to keep a clean report on SonarQube. Therefore I would like to have a static analysis summary of my project before I commit the changes.

troop363...@gmail.com

unread,
Jul 6, 2017, 2:51:53 PM7/6/17
to SonarLint
When will this be enabled so the SonarLint plugin for CLion will work?  I'd really like to be able to use this on my C++ code the way I do on my Java code with SonarLint for Java.

Duarte Meneses

unread,
Jul 10, 2017, 4:16:05 AM7/10/17
to troop363...@gmail.com, SonarLint
Hi, 
The work required to support analysis of C/C++ files in CLion is not planned. We would like to support it at some point, but I can't give a time frame. 

 

On 6 July 2017 at 20:51, <troop363...@gmail.com> wrote:
When will this be enabled so the SonarLint plugin for CLion will work?  I'd really like to be able to use this on my C++ code the way I do on my Java code with SonarLint for Java.

--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/55d07c7e-b3dc-4aaa-817f-4f46b7de400f%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Duarte Meneses | SonarSource
Software Engineer

Are you using SonarLint in your IDE?

Reply all
Reply to author
Forward
0 new messages