PC Review


Reply
Thread Tools Rate Thread

C# Code Checker

 
 
Paul Jones
Guest
Posts: n/a
 
      24th Nov 2007
Does anyone know if there is a C# code checker that will spot any (or
preferably all) of the following:
- Unused parameters in functions;
- Unused functions;
- Wrong scope (of functions, variables, enums, etc.,) e.g. can their scope
be reduced from public to protected or private.

Thanks, Paul


 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      24th Nov 2007
Paul Jones <(E-Mail Removed)> wrote:
> Does anyone know if there is a C# code checker that will spot any (or
> preferably all) of the following:
> - Unused parameters in functions;
> - Unused functions;
> - Wrong scope (of functions, variables, enums, etc.,) e.g. can their scope
> be reduced from public to protected or private.


FXCop may well do all of those - I can't say I use it myself.

ReSharper (jetbrains.com) is excellent at spotting this kind of thing
within the IDE, but I don't know whether you can tell it to perform the
check outside the IDE and produce a report, for instance.

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
 
Reply With Quote
 
Chris
Guest
Posts: n/a
 
      24th Nov 2007
"Paul Jones" <(E-Mail Removed)> wrote in message
news:07%1j.1989$(E-Mail Removed)...
> Does anyone know if there is a C# code checker that will spot any (or
> preferably all) of the following:
> - Unused parameters in functions;
> - Unused functions;
> - Wrong scope (of functions, variables, enums, etc.,) e.g. can their scope
> be reduced from public to protected or private.


ReSharper, as John recommended, does all of those things well. Unfortunately
I had to stop using it because of a few silly things, like it made my
context menu ridiculously long.

Chris

 
Reply With Quote
 
Hilton
Guest
Posts: n/a
 
      24th Nov 2007
Paul,

I've been tempted to develop something along those lines - even something
for my own use. There are many opportunities here such as the one you've
mentioned, plus others such as (for example) passing OK, Cancel, Retry to a
MessageBox on the Smartphone - that parameter is always invalid, and
changing method to private in a post-op, and notifying you of recursion
especially in "public int Age { get { this.Age; } }".

I use FxCop regularly and it does help, I wish they would update it
occasionally though - FxCop was release 6/2006.

Hilton


"Paul Jones" <(E-Mail Removed)> wrote in message
news:07%1j.1989$(E-Mail Removed)...
> Does anyone know if there is a C# code checker that will spot any (or
> preferably all) of the following:
> - Unused parameters in functions;
> - Unused functions;
> - Wrong scope (of functions, variables, enums, etc.,) e.g. can their scope
> be reduced from public to protected or private.
>
> Thanks, Paul
>



 
Reply With Quote
 
Peter Bromberg [C# MVP]
Guest
Posts: n/a
 
      24th Nov 2007
FxCop with "a grain of salt", please. If you run it against the Microsoft
Enterprise Library you'll get a list of errors that will keep you busy for
days...

--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com



"Hilton" wrote:

> Paul,
>
> I've been tempted to develop something along those lines - even something
> for my own use. There are many opportunities here such as the one you've
> mentioned, plus others such as (for example) passing OK, Cancel, Retry to a
> MessageBox on the Smartphone - that parameter is always invalid, and
> changing method to private in a post-op, and notifying you of recursion
> especially in "public int Age { get { this.Age; } }".
>
> I use FxCop regularly and it does help, I wish they would update it
> occasionally though - FxCop was release 6/2006.
>
> Hilton
>
>
> "Paul Jones" <(E-Mail Removed)> wrote in message
> news:07%1j.1989$(E-Mail Removed)...
> > Does anyone know if there is a C# code checker that will spot any (or
> > preferably all) of the following:
> > - Unused parameters in functions;
> > - Unused functions;
> > - Wrong scope (of functions, variables, enums, etc.,) e.g. can their scope
> > be reduced from public to protected or private.
> >
> > Thanks, Paul
> >

>
>
>

 
Reply With Quote
 
Hilton
Guest
Posts: n/a
 
      26th Nov 2007
Peter,

I make sure to only enable the rules I care about. Do you know if MSFT
plans on updating FxCop? Do you know of any better tools out there worth
trying?

Thanks,

Hilton


"Peter Bromberg [C# MVP]" <(E-Mail Removed)> wrote in message
news:62390D19-8705-46B9-B834-(E-Mail Removed)...
> FxCop with "a grain of salt", please. If you run it against the Microsoft
> Enterprise Library you'll get a list of errors that will keep you busy for
> days...
>
> --Peter
> "Inside every large program, there is a small program trying to get out."
> http://www.eggheadcafe.com
> http://petesbloggerama.blogspot.com
> http://www.blogmetafinder.com
>
>
>
> "Hilton" wrote:
>
>> Paul,
>>
>> I've been tempted to develop something along those lines - even something
>> for my own use. There are many opportunities here such as the one you've
>> mentioned, plus others such as (for example) passing OK, Cancel, Retry to
>> a
>> MessageBox on the Smartphone - that parameter is always invalid, and
>> changing method to private in a post-op, and notifying you of recursion
>> especially in "public int Age { get { this.Age; } }".
>>
>> I use FxCop regularly and it does help, I wish they would update it
>> occasionally though - FxCop was release 6/2006.
>>
>> Hilton
>>
>>
>> "Paul Jones" <(E-Mail Removed)> wrote in message
>> news:07%1j.1989$(E-Mail Removed)...
>> > Does anyone know if there is a C# code checker that will spot any (or
>> > preferably all) of the following:
>> > - Unused parameters in functions;
>> > - Unused functions;
>> > - Wrong scope (of functions, variables, enums, etc.,) e.g. can their
>> > scope
>> > be reduced from public to protected or private.
>> >
>> > Thanks, Paul
>> >

>>
>>
>>



 
Reply With Quote
 
Bob Powell [MVP]
Guest
Posts: n/a
 
      26th Nov 2007
If you want serious code analysis get a copy of NDepend. It has a code query
language (CQL) that if the stuff you're looking for isn't already defined
you can use to create a query that will extract whatever information you
like.

www.ndepend.com

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.


"Paul Jones" <(E-Mail Removed)> wrote in message
news:07%1j.1989$(E-Mail Removed)...
> Does anyone know if there is a C# code checker that will spot any (or
> preferably all) of the following:
> - Unused parameters in functions;
> - Unused functions;
> - Wrong scope (of functions, variables, enums, etc.,) e.g. can their scope
> be reduced from public to protected or private.
>
> Thanks, Paul
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Acccess Spell Checker VBA code nnyami General Software 0 27th Oct 2009 06:56 PM
Searching VBA code to disable excel compatibilty checker bartvd Microsoft Excel Programming 1 11th Jun 2009 02:19 PM
Code to configure Spell Checker =?Utf-8?B?R29yZG9u?= Microsoft Excel Programming 0 10th Sep 2006 04:44 PM
Commands to disable the virus checker when sending e-mails from code =?Utf-8?B?Tmljcml0ZQ==?= Microsoft Outlook VBA Programming 1 20th Oct 2003 05:46 PM
spell checker turned off in code Sara Bradner Microsoft Access VBA Modules 0 30th Jul 2003 03:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:27 AM.