ReSharper 2016.1 Help

Code Cleanup

ReSharper | Edit | Cleanup Code
Ctrl+Alt+F
ReSharper_CleanupCode

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, a project or in the entire solution.

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

If you want code cleanup to perform a different set of tasks, you can create custom cleanup profiles and specify the set of desired tasks 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 tasks are available in C# , some are available in several languages, others are language-specific. The table below lists all code cleanup tasks and languages/technologies where they are supported.

Code Cleanup Task C# VB.NET C++ HTML ASPX Razor JavaScript TypeScript CSS XML XAML RESX Build Scripts Protobuf JSON
Enforce 'var' keyword usage settings feature_available feature_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 feature_available
Arrange modifiers feature_available feature_available
Fix built-in type references feature_available
Optimize 'using'/'import'/@Register directives / import statements feature_available feature_available feature_available feature_available feature_available
Reformat code feature_available feature_available feature_available feature_available feature_available feature_available feature_available feature_available feature_available feature_available feature_available feature_available feature_available feature_available feature_available
Reformat embedded XML doc comments feature_available feature_available feature_available feature_available
Apply file layout feature_available
Normalize quotes feature_available feature_available feature_available
Terminate statements feature_available feature_available
Optimize reference comments feature_available
Collapse empty tags feature_available
Alphabetize properties feature_available

See Also

Last modified: 19 August 2016