473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

C# Code Checker

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
Nov 24 '07 #1
6 8173
Paul Jones <no****@nomail.comwrote:
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 - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Nov 24 '07 #2
"Paul Jones" <no****@nomail.comwrote in message
news:07*****************@newsfe4-win.ntli.net...
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

Nov 24 '07 #3
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" <no****@nomail.comwrote in message
news:07*****************@newsfe4-win.ntli.net...
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

Nov 24 '07 #4
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" <no****@nomail.comwrote in message
news:07*****************@newsfe4-win.ntli.net...
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


Nov 24 '07 #5
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]" <pb*******@yahoo.NoSpamMaam.comwrote in message
news:62**********************************@microsof t.com...
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" <no****@nomail.comwrote in message
news:07*****************@newsfe4-win.ntli.net...
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



Nov 26 '07 #6
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" <no****@nomail.comwrote in message
news:07*****************@newsfe4-win.ntli.net...
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
Nov 26 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

84
by: Andy Glew | last post by:
I am in search of any rigourous, scientific, academic or industrial studies comparing naming conventions in C++ or similar languages such as Ada: Specifically, are names formed with...
7
by: Hank Reed | last post by:
I am trying to use the spell checker on an unbound control in Access 2000. I run the checker in the AfterUpdate event of the control. After the spell checker is done, I get the following message:...
3
by: Bas Wassink | last post by:
Hello there, I'm having trouble understanding a warning produced by 'splint', a code-checker. The warning produced is: keywords.c: (in function keyw_get_string) keywords.c:60:31: Released...
8
by: Joe | last post by:
Hello All: Does anyone know of a spell checker that works with .NET? Any options will be welcome. TIA, -- Joe
13
by: kolmogolov | last post by:
/* Hi, I have removed things irrelevant to reproducing the problem. What's wrong with my code? Thanks in advance for any hint! 1166425362 */ #include <stdio.h> #include <stdlib.h> #include...
4
by: sweetguy1only | last post by:
Hi all, I am a MS Access developer using VB 6 (yes, I know it is a bit old). The problem I am having is, I have a software that allows my customers to put in the information of their clients....
6
by: Neil | last post by:
Is there way to have control over the MS-Access spell checking (besides just launching it)? We want to tell it to check all records, but skip certain fields (or, alternatively, ONLY check certain...
2
Ganon11
by: Ganon11 | last post by:
Hey all, So this was an assignment in my Data Structures and Algorithms class - we were supposed to make a C++ implementation of the spell checker described here. A Java version was also...
7
by: SMALLp | last post by:
Hy! I desperately need help! I need to make application that would accept Pascal code and check if it returns good results. My idea is (from a beginner point of view) to make application in...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.