Resharper Naming Style for Machine.Specifications

On February 11, 2010, in Uncategorized, by derekgreer

If you’re doing BDD-style specifications and using underscores within your variable names, the default Resharper settings will warn you about violating the naming style rules as shown below:

Fortunately, Machine.Specifications (MSpec) extends Resharper to allow for the creation of custom rules which affect only your MSpec types. To create a custom rule for MSpec, follow these steps:

Step 1: Open the Resharper Options Dialog.

Step 2: Navigate to Languages | Naming Style and under “User defined naming rules” click “Add”.

Step 3: This displays the “Edit Extended Naming Rule dialog.  In the “Rule Definition:” text box, give your new rule a name such as “Machine.Specifications Rules”.

Step 4: Within the Affected entities list, un-check Class and scroll to the bottom to locate the entries starting with Machine.Specifications. Select all of these entries.

Step 5: Select all options under Access rights: and leave options under Static/non-static: selected.

Step 6: Add a new naming style to associate this rule to by clicking the Add icon and selecting the desired naming style (e.g. all_lower).

The following diagram shows the dialog after these steps:

After selecting OK, Resharper now ignores the naming warnings for the MSpec types:

Tagged with: