Hi all,
I am trying to get my head around FxCop. (Shouldn't be that hard). I am looking at an existing project so I thought I would start with just one of the small helper libraries. It is my "common" library that has things like extension methods.
The first time I ran it over the common DLL I got the following error with an extension method, (I pointed it at the debug folder compiled DLL):
CriticalWarning, Certainty 75, for IdentifiersShouldBeSpelledCorrectly
{
Target : #IsNullOrEmptyOrJustSpaces(System.String) (IntrospectionTargetMember)
Id : s (String)
Location : file:///C:/hoh_code/bailey_dev/Bailey/trunk/source/Bailey.Common/Extensions/StringExtensions.cs<9> (String)
Resolution : "In method 'StringExtensions.IsNullOrEmptyOrJustSpaces(
this string)', consider providing a more meaningful
name than parameter name 's'."
Help : http://msdn2.microsoft.com/library/bb264492(VS.90).aspx (String)
Category : Microsoft.Naming (String)
CheckId : CA1704 (String)
RuleFile : Naming Rules (String)
Info : "The individual words that make up an identifier should
not be abbreviated and should be spelled correctly.
If this rule generates a false positive on a term that
should be recognized, add the word to the FxCop custom
dictionary."
Created : 04/02/2010 12:58:50 (DateTime)
LastSeen : 04/02/2010 12:58:50 (DateTime)
Status : Active (MessageStatus)
Fix Category : Breaking (FixCategories)
the class used to look like this:
using System;
namespace Bailey.Common.Extensions
{
public static class StringExtensions
{
/// <summary>
/// Checks that a string is either, NULL an Empty String or contains only spaces.
/// </summary>
/// <param name="s">The string to be checked</param>
/// <returns>bool value</returns>
public static bool IsNullOrEmptyOrJustSpaces(this string s)
{
return (s == null || s.Trim() == String.Empty);
}
}
}
Now it looks like this:
using System;
namespace Bailey.Common.Extensions
{
public static class StringExtensions
{
/// <summary>
/// Checks that a string is either, NULL an Empty String or contains only spaces.
/// </summary>
/// <param name="stringToBeChecked">The string to be checked</param>
/// <returns>bool value</returns>
public static bool IsNullOrEmptyOrJustSpaces(this string stringToBeChecked)
{
if (String.IsNullOrEmpty(stringToBeChecked)) { return true; }
return String.IsNullOrEmpty(stringToBeChecked.Trim());
}
}
}
I have tried rerunning FxCop, deleting the compiled DLL, deleting the whole library and pulling it back out of SVN and rebooting the machine but I still get the same error.
As I understand it (could be wrong), That error should no longer be appearing as I have fixed the poor naming and the comments, build, rebuild and cleaned the project but it still says I am doing it wrong.
My ultimate goal is to have this running via my new CI Server and saving out to a file, but I do not want to go that far till I have the basics working and clean in my mind.
Could someone help me understand where I am going wrong please?
Thanks
Edit
I think I must have been pointing to the wrong DLL some how, would swear I checked the path, I know I went to the root of C at least once to retrace the path to check that. It is now picking up a load more errors in the library and is reflecting the changes I make each time.