cppcheck-vs-addin icon indicating copy to clipboard operation
cppcheck-vs-addin copied to clipboard

Appears to do nothing.

Open ncook-hxgn opened this issue 4 years ago • 25 comments

Hi there,

I installed CppCheck and then this extension. I have a 'cppcheck analysis output' stream available in my Visual Studio Output window, however when I CppCheck Current Project, nothing happens. What gives?

The extension didn't ask for CppCheck's location.

Edit: I am able to use CppCheck via it's CLI successfully, generating output xmls files etc.

Surely this is some error on my behalf?

ncook-hxgn avatar Jan 08 '21 13:01 ncook-hxgn

It's hard to say without debugging. Could be that something in the project structure or settings prevents the VS add-in from reading the project or from interpreting it as a C++ project. You could try a different project from a different source (some simple open-source tool from Github, for example. I used to use the LLVM solution for testing).

VioletGiraffe avatar Jan 08 '21 21:01 VioletGiraffe

I will give the LLVM solution a go (didn't realise it I could just install it with VS before I started building it!).

Are there any secret-squirrel logging features available for the plugin?

Thanks for the speedy respone - apologies for taking a few days to get back to you.

ncook-hxgn avatar Jan 12 '21 17:01 ncook-hxgn

Are there any secret-squirrel logging features available for the plugin?

Unfortunately, not. I didn't encounter many problems for which logging could be helpful. But clearly, it's time to add some. I'll look into it right now.

VioletGiraffe avatar Jan 12 '21 18:01 VioletGiraffe

I seem to have the same problem, the code for determining types of items in a project doesn't work the way it used to. I'm looking into it.

VioletGiraffe avatar Jan 13 '21 10:01 VioletGiraffe

That's great news. It would be awesome to have this working in VS alongside Clang-Tidy and MS Code Analysis 💪

ncook-hxgn avatar Jan 13 '21 16:01 ncook-hxgn

To be honest, I'm disappointed in cppcheck - a big part of the reason why I haven't actively developed this extension for a long while. Cppcheck doesn't hold a candle to clang.

Try the attached extension: CppcheckPlugin.zip

VioletGiraffe avatar Jan 13 '21 20:01 VioletGiraffe

That's a bit disheartening to hear about cppcheck! Howcomes?

I renamed the zip to .vsix, and got an installation error.. it says it's missing an extension.vsixmanifest..

ncook-hxgn avatar Jan 14 '21 10:01 ncook-hxgn

You need to extract the VSIX file from the ZIP archive, not just rename it :)

VioletGiraffe avatar Jan 14 '21 10:01 VioletGiraffe

Ahaa, you got me!

So I am curious although it's off topic - what do prefer about Clang over CppCheck?

ncook-hxgn avatar Jan 14 '21 10:01 ncook-hxgn

Cppcheck seems to suffer from not being an actual compiler, and also from having a very small development team. Failures to find includes, especially the system ones (Windows SDK), sometimes errors interpreting valid C++ syntax. Also, there could be way more different useful checks. But don't be disheartened by my rambling, any static analysis tool is better than no tool, and the more you use simultaneously - the better.

VioletGiraffe avatar Jan 14 '21 10:01 VioletGiraffe

That all makes sense to me! From what I remember of reading the CppCheck blurb on their website, they do say they have a slimmer focus, with their tool. I agree entirely, we'll need to figure out which tools serve us best for certain checks and work with them accordingly. Horses for Courses as they say 👍 I am just glad we are in a place now with VS where I can get three tools into developers hands for free - that's a long way from where we've been historically.

I've installed the extension from the zip, still no output I'm afraid. (It reports 1.4.3 as version). I'm attempting to scan LLVM.sln's clang executables/diagtool.vcxproj.

ncook-hxgn avatar Jan 14 '21 10:01 ncook-hxgn

1.4.3 is the updated version indeed. Odd, since I was able to reproduce the error and then I fixed it. I guess I can't get away without proper debug logging after all. It'll take a bit because I don't have much free time these days, but I'll get back to you.

VioletGiraffe avatar Jan 14 '21 11:01 VioletGiraffe

Sure thing :) I appreciate how responsive you've been, and there's no immediate rush - I am very much in the researching phase at the moment.

FWIW I'm using VS 2019 16.7.3 on a recently updated x64 Windows 10 Pro box (probably should have mentiond that earlier).

If you need a tester, I am here and happy to help - it doesn't take long to install the extension, open the LLVM solution, and have a go with it.

ncook-hxgn avatar Jan 14 '21 11:01 ncook-hxgn

Still no output with VS 2019 16.10.3 on Win10 x64 21H1. I figured I'd get either a dialog or output in the log window showing analysis progress.

I might see if I can get this to build. I haven't investigated implementing an IDE extension before so the attempt should be interesting.

(I recently discovered the cppstories.com blog (good for advanced C++ programmers) and saw mention of the SonarSource static analyzer in his weekly newsletter. When I looked up static analyzers, I found cppcheck, and looking for VS integration led me here.)

SpareSimian avatar Aug 03 '21 15:08 SpareSimian

I cloned/built/installed and the current master fixes the problem for me, using VS 16.10.4.

SpareSimian avatar Aug 03 '21 16:08 SpareSimian

Interesting, thanks for the info. I'll check what it was that the master fixed over the last release and will then update the release.

Although there's non-zero chance that it worked simply because you built it locally, and didn't work because there's something wrong with the references in my binary package when it runs in your VS.

VioletGiraffe avatar Aug 03 '21 17:08 VioletGiraffe

I unloaded my version and tried the one from your January zip file and that does nothing, as with 1.4.2. So it sounds like the build environment might be a factor.

SpareSimian avatar Aug 03 '21 17:08 SpareSimian

Both my Release and Debug builds produce output. So it's not the configuration.

SpareSimian avatar Aug 03 '21 18:08 SpareSimian

CppcheckPlugin (2).zip Please try this VSIX I just built from master head on my machine, does it work?

VioletGiraffe avatar Aug 03 '21 19:08 VioletGiraffe

@VioletGiraffe that one also didn't work for me :)

yuyoyuppe avatar Aug 12 '21 20:08 yuyoyuppe

@yuyoyuppe, are you able to build the extension from source to confirm that the problem is related to the build environment/settings and not the source code itself?

VioletGiraffe avatar Aug 12 '21 21:08 VioletGiraffe

Yep, building current master worked for me, so it's definitely something with your env

yuyoyuppe avatar Aug 12 '21 22:08 yuyoyuppe

What about the package built by Github? https://github.com/VioletGiraffe/cppcheck-vs-addin/suites/3451024510/artifacts/81918205

VioletGiraffe avatar Aug 13 '21 08:08 VioletGiraffe

@VioletGiraffe that one does work, thank you.

Although the tool itself didn't produce any useful results unfortunately :(

yuyoyuppe avatar Aug 14 '21 19:08 yuyoyuppe

@yuyoyuppe, maybe you didn't have enough errors in your code :) Thank you for letting me know the version built by Github VM works.

VioletGiraffe avatar Aug 14 '21 20:08 VioletGiraffe