ReSharper Help

Code Cleanup

ReSharper | Tools | Cleanup Code
Ctrl+Alt+F

Code cleanup allows you to apply a number of ReSharper's code style features (see the table below) in a bulk mode to instantly eliminate code style violations in one or more files, the whole project or even solution.

Code cleanup can have various configurations (profiles) that you can apply in different cases according to your needs. There are two default profiles that can be applied out-of-the-box:

If you want the code cleanup to perform a different set of tasks, you can create custom cleanup profiles and specify the set of desired features there. You can also choose a default or a custom profile to be used for the silent cleanup.

Fixing inconsistent naming is not included in code cleanup because it can lead to naming conflicts. To learn how to deal with inconsistent naming, see Naming Style.

Most of ReSharper's code cleanup features are available in C# , some are available in several languages, others are language-specific. The table below lists all code cleanup features and languages/technologies where they are supported.

Code Cleanup Feature C# VB.NET C++ HTML ASPX Razor JavaScript TypeScript CSS XML XAML RESX Build Scripts
Enforce 'var' keyword usage settings feature_availablefeature_available
Update file header feature_available
Remove code redundancies feature_available
Use auto-property, if possible feature_available
Make field read-only, if possible feature_available
Arrange qualifiers feature_available
Arrange modifiers feature_availablefeature_available
Fix built-in type references feature_available
Optimize 'using'/'import'/@Register directives / import statements feature_availablefeature_availablefeature_availablefeature_availablefeature_available
Reformat code feature_availablefeature_availablefeature_availablefeature_availablefeature_availablefeature_availablefeature_availablefeature_availablefeature_availablefeature_available
Reformat embedded XML doc comments feature_availablefeature_availablefeature_availablefeature_available
Apply file layout feature_available
Normalize quotes feature_availablefeature_availablefeature_available
Terminate statements feature_availablefeature_available
Optimize reference comments feature_available
Collapse empty tags feature_available
Alphabetize properties feature_available

See Also

Last modified: 30 June 2015