Code Cleanup provides two default cleanup profiles - Reformat Code and Full Cleanup - for performing common tasks. They provide the advantage of using Code Cleanup right away, but you cannot edit them. If you need custom cleanup, you can create your own custom profiles for performing specific tasks. See Creating Custom Profiles for guidelines.
The Reformat Code profile only modifies code formatting according to settings configurable in Code Editing | [Language] | Formatting Style pages of ReSharper options. That is, Reformat Code affects blank lines, layout of braces, line breaks, wrapping, spaces, indentation, aligning multiline constructs, and a number of other formatting options.
Full Cleanup is a lot more powerful profile as it complements code reformatting with additional actions. Specifically, it removes code redundancies, converts properties with backing fields to auto-properties, makes fields read-only if possible, arranges 'this' qualifier, and performs a number of other tasks (see table below).
Full Cleanup vs Reformat Code
|Action||Full Cleanup||Reformat Code|
|Arrange 'this' qualifier|
|Remove code redundancies|
|Use auto-property, if possible|
|Make field read-only, if possible|
|Use 'var' in declaration||
Can change explicit to 'var' and vice versa, specifically:
||Does not change anything|
|Update file header|
|Optimize using directives|
|Shorten qualified references|
|Reformat embedded XML doc comments|
|Reorder type members|
This feature is supported in the following languages/technologies:
The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see the corresponding topics in the ReSharper by Language section.
- Running Code Cleanup
- Creating Custom Profiles
- Usage Scenarios
- Complete Statement
- Importing Namespaces
- Auto-Inserting Parentheses and Quotes
- ReSharper Options | Code Editing | Code Cleanup
- ReSharper Options | Code Editing | File Header Text
- ReSharper Options | Code Editing | C# | Formatting Style
- ReSharper Options | Code Editing | Visual Basic .NET | Formatting Style
- ReSharper Options | Code Editing | HTML | Formatting Style
- ReSharper Options | Code Editing | CSS | Formatting Style
- ReSharper Options | Code Editing | XML | Formatting Style