473,569 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8186
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.co m>
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******** *********@newsf e4-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******** *********@newsf e4-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******** *********@newsf e4-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*******@yaho o.NoSpamMaam.co mwrote in message
news:62******** *************** ***********@mic rosoft.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******* **********@news fe4-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******** *********@newsf e4-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
5855
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 underscores more or less readable than names formed with MixedCase StudlyCaps camelCase?
7
3499
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: The Macro or Function set to the BeforeUpdate or ValidationRule Property for this field is preventing MS Access from saving the data in the...
3
2711
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 storage Keywords.Keyword reachable from global A global variable does not satisfy its annotations when control is transferred. (Use -globstate to...
8
2102
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
2663
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 <string.h>
4
6244
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. A client of one of my customer has a last name of "Cotten". Whenever they put in the last name as "Cotten", the spell checker automatically...
6
10822
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 fields). Is that possible? Alternatively, if that's not, we noticed that the spell checker skips fields that are disabled. So one could disable the...
2
11967
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 provided, which I pretty much stole line for line (translating as necessary, of course). I got the program working...most of the time. I'll post the code...
7
5840
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 python that would send code (text) to pascal compiler (Free pascal compiler that can be used from command prompt in windows) and it would return...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.