- 3 minutes to read
The Rules options page specifies the small refactorings that are applied to the processed code during cleanup.
The Format Code option specifies whether CodeRush Classic applies the specified code formatting options to the code after the clean-up operation has been performed.
The refactorings are applied in the same order as they appear on the options page. To change the selected refactoring priority, click the Up or Down button located at the top right part of the options page.
Below is a list of available refactorings. Note that this list is language specific.
- Convert “” to string.Empty
- Force braces in “do”, “while” statements
- Force braces in a “fixed” statement
- Force braces in “for”, “foreach” statements
- Force braces in an “if..else” statement
- Organize members
- Force braces in “using”, “lock” statements
- Make properties auto-implemented
- Make the variable implicit
- Remove all comments, excluding XML comments
- Remove all regions
- Remove the redundant “base” qualifier
- Remove the redundant “this” qualifier
- Remove unreachable code
- Remove unused namespace references
- Remove unused variables
- Remove user blocks
- Use an explicit internal modifier
- Use an explicit private modifier
- Remove all comments
- Remove default values
If you set focus on the Organize members checkbox in the rules list, the member organizer options section appears at the bottom of the options page.
The right part of the section displays organization rules for the scope selected in the list on the left.
CodeRush Classic organizes code elements into groups and applies sorting within these groups. The groups are located in the same order as they appear on the options page. You can move groups up () or down () within the list.
The count of blank lines between groups is specified by the option located under the group list. The Sort initialized fields option specifies that the member organizer can reorder initialized fields, which may break the program logic.
Click the button to add a new group for the selected scope, or click the ellipsis button to the right of the required group to edit its properties. In either case the Group properties window is invoked.
The Group properties window includes the following options:
Criteria by which code elements are organized into a group.
The list of sorting criteria within a group. Note that criteria are applied in the same order as they appear. Use the and buttons to move the required criterion within the list. Click the ellipsis button to specify whether to sort items in ascending order or descending order, according to this criteria.
Wrap in region
Specifies the name of the region in which the group should be wrapped.
Specifies text for the comment pasted before the first item in the group.
Count of empty lines between members in the group
The interval between neighboring group items.