Jan 24, 2011

How To Use VS2010 Code Analysis Rules and Localization Resources in FxCop 10.0

I learned VS2010 Pro contains static code analysis rules and the stand-alone FxCop 10.0 can use them (thanks @Pedro).

By default, VS2010 code analysis rules were installed in %PROGRAMFILES%\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\Rules. If you copy assemblies in this directory to FxCop Rules directory (%PROGRAMFILES%\Microsoft FxCop 10.0\Rules by default), FxCop can detect VS2010 code analysis rules.

But, what good is it?

The stand-alone FxCop doesn't contain Maintainability and Reliability rules. Thus, this technique allows you to use them in FxCop.

Additionally, localization resources are also contained in %PROGRAMFILES%\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop. For example, VS2010 Pro Japanese Edition has ja directory in the above directory. If you copy this one to FxCop Rules directory, you can localize rule list of FxCop GUI and FxCopCmd output messages.

Localized FxCop GUI

FxCop Integrator 1.2.0 Released: Support Code Analysis Behavior Customization

I've just released FxCop Integrator 1.2.0. It supports code analysis behavior customization so that an user can specify RuleSet and some FxCopCmd options.

FxCop Integrator 1.2.0 is available here.

Summary of New Feature
Now FxCop Integrator shows [Edit Code Analysis Configuration] in  a context menu of Solution or Project.
A new context menu [Edit Code Analysis Configuration]

When you select this one, FxCop Integrator opens Code Analysis Configuration Editor window. In this window, you can specify following options:

  1. Whether or not analyzing code of a project
  2. Whether or not searching GAC for missing reference assemblies
  3. Whether or not suppressing analysis results against generated code
  4. Timeout for analysis deadlock detection
  5. Whether or not analyzing code with RuleSet
Code Analysis Configuration Editor window

Do you notice that Code Analysis Configuration Editor has Override option?
FxCop Integrator supports Solution Configuration and Project Configuration. Solution Configuration is used to analyze all projects in the solution. Project Configuration is used to analyze the specific project. If Solution Configuration and Project Configuration set different value to an option, and checked its Override, FxCop Integrator overrides option value of Solution Configuration with Project Configuration's value.

Jan 8, 2011

Design of FxCop Integrator New Feature: Support Ruleset and Configuration

I'm designing "Code Analysis Configuration", a new feature of FxCop Integrator, to support Ruleset and code analysis behavior configuration.

It will provide the following features.

  • Enable/Disable rules with Ruleset
  • Set some FxCopCmd option
  • Apply configuration to all projects are contained a solution
  • Override configuration on a specific project
  • Visual Configuration Editor

Enable/Disable rules with Ruleset
Ruleset is a logical grouping of code analysis rules. You can enable/disable rules with Ruleset.
I'll support to analyze your code with a built-in ruleset or a custom ruleset.

Set some FxCopCmd option
I'll enable to change some FxCopCmd option (e.g. whether FxCop searchs GAC for missing assembly or not, weather FxCop analyzes auto-generated code or not, and so on).

Apply configuration to all projects are contained a solution
If you create a configuration file for a solution, FxCop Integrator will use it to analyze each project is contained the solution.

Override configuration on a specific project
You'll be able to override "solution configuration" on a specific project. For example,  you can use different Rulesets between "Common Feature Project" and "UI Project".

Visual Configuration Editor
I'll implement Visual Configuration Editor to be able to edit above configurations in Visual Studio IDE. The following image is a preview of Visual Configuration Editor.

Visual Configuration Editor Preview

FxCop Integrator 1.1.1 Released: Code Analysis Bug Fix

I've just released FxCop Integrator 1.1.1, it contians a code analysis bug fix related "Web Site" project. In this version, you can analyze a solution contains "Web Site" project.

FxCop Integrator 1.1.1 is available here.

And, I plan to release v1.2.0 in Jan 16 2011. This version will support Ruleset and changing some FxCop options. So you will be able to customize code analysis behavior.

First Post