codechecker icon indicating copy to clipboard operation
codechecker copied to clipboard

cppcheck?

Open WallStProg opened this issue 9 years ago • 10 comments

Any plans to include support for other static analysis tools, e.g., cppcheck?

WallStProg avatar Jan 09 '17 21:01 WallStProg

We built CodeChecker with a plugin framework so it can be easily extended with new analyzers. Our current focus is to support Clang and Clang tidy but it should not be too much work to add cppcheck.

gyorb avatar Jan 10 '17 01:01 gyorb

Thanks! Do you know if it’s possible to import a csv-format file directly into CodeChecker DB?

I already have tooling that will produce csv files for clang, clang-tidy, cppcheck and PVS-Studio, so the ability to import directly would be very helpful.

Also, does CodeChecker support multiple tools against the same code-base (i.e., if we want to run all of the above tools and see a consolidated view of results across them all)?

Last but not least, can you point me at the best place to start looking at the plugin framework?

Thanks again!

On Jan 9, 2017, at 8:01 PM, Gyorgy Orban [email protected] wrote:

We built CodeChecker with a plugin framework so it can be easily extended with new analyzers. Our current focus is to support Clang and Clang tidy but it should not be too much work to add cppcheck.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Ericsson/codechecker/issues/484#issuecomment-271456331, or mute the thread https://github.com/notifications/unsubscribe-auth/AGUfn6wJMI-1NvKW9cBqAhCJ6wHY_FZ0ks5rQthggaJpZM4LevJ6.

WallStProg avatar Jan 11 '17 15:01 WallStProg

Right now CodeChecker can import plists (generated by the static analyzer) to the DB. So one possibility would be to convert the csv files to plist files and import them. Other possibility would be to implement csv file import. But in case that csv format is not an official format of any of the tools, it might not make sense to include the parsing of that format in CodeChecker.

CodeChecker runs the static analyzer and clang tidy separately, so it does support running multiple tools and collecting their results. Right now the approach for clang tidy is to parse the tidy output into plist format and load that into the DB.

I think once you have your goal, @gyorb might be able to give you some pointers how to proceed.

Xazax-hun avatar Jan 11 '17 16:01 Xazax-hun

As @Xazax-hun already mentioned you can import results only from plist xml files. If you create plist files for the results from the analyzers we should be able to import them. If you use the same run name during the import all the results will be merged into one run. (if you give different run names you can compare (diff) the results between the analyzers)

You can see how our current clangsa and clang tidy plugins are implemented here.

gyorb avatar Jan 11 '17 16:01 gyorb

Thanks for all the suggestions.

At this point, however, I’m going to have to put CodeChecker on the back burner, for a couple of reasons:

  • I have not been able to install CodeChecker on CentOS 6. I’ve tried monkeying around with the prerequisites, but it’s just not working for me.

  • It seems that CodeChecker’s dependence on plist files (as opposed to some other representation, like csv) ties it to clang tools. While I like the clang tools very much, I also need to be able to support other tools as well (like cppcheck).

If anyone has been able to get CodeChecker working on RH, I’d be very interested in giving it a look, but I don’t have time to figure this out on my own right now.

Thanks again!

On Jan 11, 2017, at 11:17 AM, Gyorgy Orban [email protected] wrote:

As @Xazax-hun https://github.com/Xazax-hun already mentioned you can import results only from plist xml files https://github.com/Ericsson/codechecker/blob/master/docs/user_guide.md#6-plist-mode. If you create plist files for the results from the analyzers we should be able to import them. If you use the same run name during the import all the results will be merged into one run. (if you give different run names you can compare (diff) the results between the analyzers)

You can see how our current clangsa and clang tidy plugins are implemented here https://github.com/Ericsson/codechecker/tree/43509a2a2c8024c9ba9b8615e0e9bfb72dcf2f4c/codechecker_lib/analyzers.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Ericsson/codechecker/issues/484#issuecomment-271913320, or mute the thread https://github.com/notifications/unsubscribe-auth/AGUfn-o6fpMwBLZgzC6X58sviihvZfx1ks5rRQCsgaJpZM4LevJ6.

WallStProg avatar Jan 12 '17 16:01 WallStProg

I have not been able to install CodeChecker on CentOS 6. I’ve tried monkeying around with the prerequisites, but it’s just not working for me.

Could you please attach some outputs (maybe into a different issue ticket) about where your install proces halts? I'm sure we can figure it out, but right now, I don't think any of us from the development team have a CentOS or RedHat ready.

whisperity avatar Jan 12 '17 17:01 whisperity

Hi everyone:

Well, for starters:

[/shared/codechecker] pip install -r .ci/basic_python_requirements … Command "/usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip-build-l8h_HQ/sqlalchemy/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-wLGDlH-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-l8h_HQ/sqlalchemy

I suspect that at least some of the problems have to do with the wrong version of python. (RH6 comes with 2.6.6, and while I have 2.7 installed, it’s in a non-standard location, and it looks like at least some of the codechecker scripts have it hard-coded, rather than relying on PATH setting).

I also notice that the build script is trying to install in /usr, which of course is only writable by root. And that’s a Good Thing, because I absolutely will not allow any package to install in /usr (unless it’s part of the base OS).

It may be that both of the above are solved with the virtualenv stuff, but that wasn’t working for me either (pip was failing with an error about "ImportError: cannot import name HTTPSHandler”).

I get it that the clang community seems to be comfortable with Ubuntu, but as I said in one of my blog posts “If you’re getting paid money to write code for Linux, there’s a good chance it’s on RedHat”. Unfortunately, even building clang on RH is a nightmare (see http://btorpey.github.io/blog/2015/01/02/building-clang/).

The sheer number of dependencies (and implicit assumptions re: those dependencies) for codechecker has the effect of turning what I hoped would be a quick install into a “science project”. And, unfortunately I just don’t have the time to dig into it at this point. Which is too bad, since it looks like codechecker could be very helpful for managing the output from several different tools.

For now, I’ll stick with my low-tech approach: csv files and Beyond Compare (http://btorpey.github.io/blog/2016/04/07/mo-static/#comparing-clang-and-cppcheck).

But, thanks for the help, and I hope to circle back around to codechecker at some point. And, please let me know if you’re able to get it running on RH/CentOS!

Regards,

Bill

On Jan 12, 2017, at 12:20 PM, Whisperity [email protected] wrote:

I have not been able to install CodeChecker on CentOS 6. I’ve tried monkeying around with the prerequisites, but it’s just not working for me.

Could you please attach some outputs (maybe into a different issue ticket) about where your install proces halts? I'm sure we can figure it out, but right now, I don't think any of us from the development team have a CentOS or RedHat ready.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Ericsson/codechecker/issues/484#issuecomment-272225139, or mute the thread https://github.com/notifications/unsubscribe-auth/AGUfnxnddoXwrrB3BC1DMhMAuJi-lcqEks5rRmD0gaJpZM4LevJ6.

WallStProg avatar Jan 12 '17 18:01 WallStProg

I've collected some ideas about binary packaging with all of our dependencies in #528. What do you think @WallStProg?

gyorb avatar Jan 25 '17 08:01 gyorb

Since v1.80 cppcheck can provide plist output with the --plist-output command line argument.

gyorb avatar Dec 11 '18 15:12 gyorb

@WallStProg CodeChecker can only execute Clang Tidy and Clang SA but we have created a converter tool to support the storage of other analyzer tools. For more information check the doc.

Now it also supports the storage of Cppcheck results.

csordasmarton avatar Mar 13 '20 09:03 csordasmarton

@WallStProg execution of cppcheck analysis has just been added to CodeChecker. See #3680

dkrupp avatar Aug 30 '22 08:08 dkrupp