We use QtCreator on Ubuntu and build our C++ software with CMake (for a “Yocto device”).
Since the SonarLint Plugin for VS Code is available, we write code and debug our software in QtCreator and analyze the files in VS Code + SonarLint. Of course this is only a workaround. (Debugging in VS Code is bad for big C++ projects and many many features are missing. CLion has similar problems especially for remote debugging. CLion is no alternative and slow for big projects.)
- Do you have any idea how we can use SonarLint in QtCreator? (There is no “official” plugin)
- Is there any command line tool e.g. similar to Clang-Tidy in QtCreator?
- If not, is it difficult to write a plugin similar to the SonarLint plugin in VS Code for QtCreator?
- Do you have a description regarding the JSON communication between the VS Code SonarLint plugin and the sonarlint language server? Maybe we can write a simple plugin and use the official sonarlint language server that is already used in VS Code. Is there any example C or python source code that creates the sonarlint language server process that we could use in QtCreator or in a standalone tool?
Hello, thanks for you interest in SonarLint!
Let me try to answer your questions in order
- SonarLint is currently only available for 4 IDE families (Visual Studio, VSCode, IntelliJ and its siblings, Eclipse and its derivatives) and indeed there is no integration with QtCreator as far as I can tell.
- Unfortunately, there is no standalone CLI for SonarLint (and yes, this is something that a lot of people are interested into). This being said, if you want to run the linting as part of your continuous integration pipelines, you can have a look at SonarQube or SonarCloud.
- I had a quick look at QtCreator’s plugin API, in theory I guess we could imagine to build a SonarLint plugin. We currently don’t have any plans for it.
- SonarLint for VSCode uses a fairly recent version of the Language Server Protocol, with a few extensions specific to SonarLint. It seems that QtCreator has some support for “external” language servers, so I guess it should be possible to integrate with SonarLint’s language server to at least get diagnostics highlighted in the IDE.
One potential issue I see is that the C++ analyzer that we ship with SonarLint for VSCode is not open source, so I’m not sure how legal it would be to extract it from there and run it with the language server for an IDE that we do not officially support.