I’ve had publication of a little FxCop rule-building toolkit on my todo list for at least the past three years. I finally got the beastie out the door yesterday evening…
The Bordecal tools for FxCop include two main pieces:
- A rule development framework with two main pieces:
- A testing framework for custom rules, and
- Rule base classes that allow configuration via code rather than an embedded XML file.
- A set of custom rules.
The testing framework is probably the single most important part. For those of you who are already familiar with Roy Osherove’s FxCopUnit, it is important to understand that this is a rather different approach to rule testing. It is focused on targeting entire sample target assemblies with the goal of detecting both false negatives and false positives. It’s also very picky about matching expected to actual results, largely because I believe that the violation details exposed to the rule user are almost as important as detection of the violation itself. That said, I could probably be convinced to make this behaviour configurable in some future version if enough folks vote for the feature.
The rule base classes that form the other part of the development toolkit are motivated primarily by my personal annoyance with the embedded XML configuration approach. The fact that so many beginner rule developers seem to have problems with generating an appropriate embedded XML resource was my main reason for including it in the published toolkit. However, there’s no need to use these base classes in order to use the testing framework since the testing framework uses fxcopcmd.exe and will be able to use any rule that FxCop itself can find.
The custom rules are meant primarily as an example of how to use the development toolkit, as is the rule test project that can be found in the source code. However, I’ve chosen rules that I tend to write and re-write at each day job, so I’m guessing that at least some folks are likely to find them interesting in their own right.
If you wish to report a bug or request a feature for either the development framework or the custom rule set, please use the project issue tracker. Similarly, if you need help using the toolkit, please use the project discussion list so that other users with similar problems may see the answers to your questions even if they do not read this blog.
And now there’s one more disposition post to finish up before I can finally give Bordecal.ImportsSorter some much-needed attention…