Project Description
Utility code to help build FxCop custom rules.

This project is a collection of utility classes and custom rules. The purpose of the custom rules are two fold. First they should be usable. Some will work without any modification and some will require deriving your own rule to fill in information specific to your application. The second purpose of the custom rules is to show how custom FxCop rules can be written. (Notice I said "can" not "should".)

Utilities

CciHelper - Makes working with Cci a little easier.
ComponentDictionary - Processes the InitializeComponent method and associated resources to get control information.
ComponentsCache - Use with ComponentDictionary to cache values used by multiple rules.
EventInformation - Holds information about an event.
InstructionHelper - A bunch of methods to help work with IL instructions. This is probably going away because I'm switching over to using the Visit methods.
TypeNodeHelper - Methods to help work with TypeNodes.

Rules

BackingFieldShouldHaveSameNameAsProperty - Flags issues where the backing field is not the same as the property.
CallBaseDispose - Verifies that base.Dispose(bool) is called from overrides of Dispose(bool) methods.
CallComponentsDispose - Verify that this.components.Dispose() is called if the this.components field exists and was initialized in the InitializeComponent method.
ComponentsShouldBeLocalizable - Verifies that components such as WinForms and UserControls are localizable.
DoNotUseToStringOnAString - Flags where ToString is called on something that is already a String.
FixInconsistentAttributes - Finds attributes that should be removed.
FixSimplePerformanceChanges - Finds simple code changes that can help performance.
FollowAccessibilityRules - Guidelines for WinForms accessibility. Specifically for screen reading software.
MarkFieldReadOnly - Flags fields that are only set in the constructor and can therefore be flagged as readonly.
RaiseEventsCorrectly - Checks that events are raised correctly.
RemoveEmptyEventHandlers - Flags empty event handlers so they can be removed.
RemoveEmptyTry - Flags try/catches with nothing in the try.
TypecastingProblems - Flags typecasting performance issues.
UseCharInsteadOfString - Use char instead of string in methods that can take either and the string is a single character long.
UseStrongestType - Not 100% yet and only works on debug code. Checks that the strongest type is used for variables and return values.
UseTypedDataSetFeatures - Finds places where you can switch to using typed DataSet features if you are already using a typed DataSet.

See Also

http://jslstylecop.codeplex.com - Similar to FxCop but uses StyleCop.
http://jslmstesthelper.codeplex.com/ - Some useful helper for MSTest. The test project uses this.

Last edited Dec 26, 2010 at 11:12 PM by JeffLeBert, version 18