Question

Does anyone know an open-source and/or free code-scanner for automated code analysis in C#, C or C++?

I know for Java there's some brilliant stuff like FindBugs (Eclipse integrated), PMD, or Hammurapi.

Is there anything similar for the C-languages?

wishi

Was it helpful?

Solution

For .NET languages, you can look at Reflector CodeMetrics which provides some code analysis and design metrics. Also take a look at all of the Reflector addins.

I also second the recommendation for FxCop and StyleCop.

OTHER TIPS

StyleCop does source level analysis.

NDepend has a two-week trial license.

For C code, you may take a look at Coccinelle. It is already used to find and fix bugs in the Linux kernel.

Resharper does some code analysis especially for pointing out redundant code and logic faults.

You may be able to get some value out of running VC++ with /analyze switch. Although, this particular switch is not available with every edition. Get the compiler which ships with Windows SDK.

Through the comments here and some google magic I came to splint: http://splint.org/

  • Seems to be quite helpful for C.
  • easy to use
  • not Visual Studio dependent

The FxCop and StyleCop extensions look very sophisticated for VisualStudio and .Net.

Thanks so far, wishi

You'll find a list of free and not so free static analysis tools here.

Gendarme is free and open source. It analyses at IL level and provides information related to the source files using the pdb. Even without pdb's it provides results but difficult to localize in the code.

Note that it is best to use it on release code, what is unusual for static analyzers. This is because of the IL analysis: the debug code is cluttered and leads to more false positives.

Gendarme generates a nice HTML report and can be integrated easily in a continuous build server like cc.net.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top