Domanda

Gendarme and FxCop look very similar and seem to tackle the same problem. Which would you suggest for a small team of developers (3-5) mainly working on web application with lots of business logic? Why?

È stato utile?

Soluzione

Gendarme is indeed the Mono equivalent of FxCop. Given that Microsoft is planning to ship a considerable set of Code Analysis rules with most versions of the next Visual Studio, you might want to use FxCop and stick with that. The integrated version of FxCop (called Code Analysis) is the simplest to use if your Visual Studio version supports it (Visual Studio 2010 Premium and Ultimate).

There is a Visual Studio add-in which allows you to run FxCop from inside Visual Studio Professional as well. You need to download FxCop 10 separately (it's part of the Windows Platform SDK). Do note that the Visual Studio integrated version comes with a few additional rules, so the output may differ.

As Gendarme doesn't integrate directly into Visual Studio (though you can make it part of the build process) and you won't see many people using Visual Studio use Gendarme. Mostly because it isn't too well known.

In the end I'd use FxCop from a convenience perspective. It's integrated into the version of Visual Studio I use by default and it's well known in the developer community.

But if you're not using Visual Studio Premium or Ultimate, then you can pick either or even both. Just keep in mind that if you choose both, you'll probably be receiving a number of duplicate messages or even conflicting messages as the creators of these different tools don't always agree.

If you don't mind investing some money, then, as niaher suggests, Resharper or Coderush are very useful additions (I wouldn't call them replacements, as they don't run outside of the IDE (in the continuous integration build for example)) as they provide direct feedback as you're writing the code. Often even without having to compile it. And they often provide the ability to "apply the fix" without you having to figure out exactly what to do.

Altri suggerimenti

An alternative or a good complement to FxCop/Gendarme would be to use the commercial tool NDepend. With this tool one can write Code Rule over LINQ Queries (namely CQLinq). Disclaimer: I am one of the developers of the tool

More than 200 code rules are proposed by default, these include design, architecture, code quality, code evolution, naming conventions, dead code, .NET Fx usage...

CQLinq is dedicated to write code rules that can be verified live in Visual Studio, or that can be verified during build process and reported in an HTML/javascript report.

The strength of CQLinq over FxCop or Gendarme, is that it is straightforward to write a code rule, and get immediately results. Facilities are proposed to browse matched code elements. Concretely this looks like that:

CQLinq code rule

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top