← Back to team overview

nunit-dev team mailing list archive

Re: [Fwd: Using *Cop tools]

 

Continuing this "conversation" - anyone else want to talk? :-)
 
I see now that MS StyleCop is different from FxCop. Here's a breakdown
of the tools that are available.
 
STYLECOP
StyleCop is unique AFAICS. It parses the source where the others look
at the assembly metadata. Therefore, it can be used to check style issues
like using spaces rather than tabs. It's the only tool I know of (so far)
that 
does this sort of thing.
 
Unfortunately, it's not open source and the license even has the famous 
(hideous) clause saying you may not "work around any technical limitations
in the software. Jamie's been bitten by that one. ;-) In any case, it can't
be used in our build as there's no way to run it outside of Visual Studio.
 
Nothing wrong with individuals with copies of Standard or higher VS
using it, however, so long as you use rules that conform with the ones
we set up for NUnit.
 
FXCOP
This is again a Micrsooft offering with a non-Open license. It can be run
at the command line and has a very nice (as you would expect) Windows 
runner. It can display your source code using VS or an editor of your
choosing.
 
Unfortunately, it's Windows only and so not suitable for our script. Still,
a good choice for anyone working on NUnit in VS - so long as you use
our set of rules.
 
I ran this against nunit.framework.dll and got 637 reported problems using
the full set of rules provided.
 
GENDARME
This is part of the mono project and runs on Linux under Mono and on 
Windows under either MS .NET or mono. It has Windows installer and
is available for most Linux distros as a package. There is a  rather
rudimentary Windows runner, a console runner and a NAnt task. 
The output is HTML - which seems like a plus to me although I think 
it could be cleaned up and organized better.
 
Running it against nunit.framework.dll, I got 875 problems using the
'medium' level of severity. There are five levels and we had 1001 
issues when I used the most stringent one.
 
SMOKEY
This project aims to outdo Gendarme, but isn't quite there yet IMO.
It has a console runner and an addin for MonoDevelop. I got it to
run on Windows (there's no installer) under Mono 2.4 but could
not make it run under MS .NET. I think it would run, if I copied
the right mono dlls to its directory. The developer has better
Windows support on his list of TODOs.
 
Using Smokey, the framework assembly had 3 errors, 368
warnings and 144 'nitpicks'  (I like that term) for a total of 515.
However, the individual issues sometimes listed a number of
sub-items that would probably be separate in FXCop.
 
My tentative conclusion is that Gendarme is the best one
for us to use as part of our standard build. Has anyone else
tried it - or any of the others?
 
Charlie
 
 
         


  _____  

From: nunit-dev-bounces+charlie=nunit.com@xxxxxxxxxxxxxxxxxxx
[mailto:nunit-dev-bounces+charlie=nunit.com@xxxxxxxxxxxxxxxxxxx] On Behalf
Of Charlie Poole
Sent: Saturday, August 01, 2009 8:23 AM
To: 'NUnit Developer Mailing List'
Subject: Re: [Nunit-dev] [Fwd: Using *Cop tools]


Correction: the tool I tried out was smokey, not gendarme. See
   http://code.google.com/p/smokey/
 
Charlie


  _____  

From: nunit-dev-bounces+charlie=nunit.com@xxxxxxxxxxxxxxxxxxx
[mailto:nunit-dev-bounces+charlie=nunit.com@xxxxxxxxxxxxxxxxxxx] On Behalf
Of Charlie Poole
Sent: Saturday, August 01, 2009 7:59 AM
To: 'Ludovic Delabre'
Cc: 'NUnit Developer Mailing List'
Subject: Re: [Nunit-dev] [Fwd: Using *Cop tools]


Hi Ludovic,
 
You have to use the email that you used when signing up with launchpad.
Maybe you can give them alternative emails as well - I'm not sure.
 
Yes, we should discuss this on the list. I'm copying it so we can get
started.
 
I thought that the built-in style-cop was replacing fxCop. Is it still 
active? I would prefer to use open source tools where we can.
 
I also have tried out Gendarme and it was pretty good. It works on
both Windows and Linux, which is a big point. Also, at my request,
the developer added the ability to specify the framework for which 
you are building so that you didn't get advice like "Use a generic here" 
when building for .NET 1.1.
 
However, I haven't looked at the status of the tools lately so it would
be good if someone did a comparison.
 
Charlie


  _____  

From: Ludovic Delabre [mailto:ldelabre54@xxxxxxx] 
Sent: Saturday, August 01, 2009 1:23 AM
To: Charlie Poole
Subject: [Fwd: Using *Cop tools]


Hi Charlie,
I've send the message bellow to the mailing list some days ago using another
e-mail of mine, so I'm not sure anyone received it...?!

Have a nice day,
Ludovic.

-------- Message original -------- 
Sujet : 	Using *Cop tools	
Date : 	Wed, 29 Jul 2009 07:30:37 +0200	
De : 	Ludovic Delabre  <mailto:ludovic.delabre@xxxxxxx>
<ludovic.delabre@xxxxxxx>	
Pour : 	NUnit Developer Mailing List  <mailto:nunit-dev@xxxxxxxxxxxxxxxxxxx>
<nunit-dev@xxxxxxxxxxxxxxxxxxx>	


Hi everyone,

I was wondering if you plan to use tools like FxCop (or Mono's 

Gendarme?) and/or StyleCop for the future nunit 3.0 ?



For those who don't know about those tools :

* FxCop allows you to analyze assemblies (IL) and reports 

design/performance/security violations. 

http://msdn.microsoft.com/en-us/library/bb429476(VS.80).aspx



I know there's an equivalent project at Mono named Gendarme : 

http://mono-project.com/Gendarme.

Haven't tried it yet, but I will ;-)



* StyleCop works on the source (C# only) to enforce a set of style and 

consistency rules.

http://code.msdn.microsoft.com/sourceanalysis



Both are configurable (which rules you want to enforce/ignore), 

extensible (by writing custom rules) and you always can exclude a 

violation (with justification) using 

System.Diagnostics.CodeAnalysis.SuppressMessage attribute.



At first glance, it's a pain but after using both for a while, I kinda 

like it... ;-)



Have a nice day,

Ludovic.




References