CodeRush

Code Formatting and Cleanup

CodeRush includes tools that make you understand the code more easily. It is gained by the code adjustment to appropriate formatting rules and the dirty code cleanup.

Code Formatting

Each developer is used to a certain code style. Code formatting in a habitual style simplifies code understanding and speeds up the development process. CodeRush can apply specified formatting rules to the code you are working with. It allows you to fine-tune formatting options for spaces, blank lines, alignment, line breaks and indentation in a variety of code constructs.

Code Formatting - CodeRush by DevExpress

The options on each page of the Editor|Code Formatting section are organized as a tree. It enables you to easily locate the desired option. The code sample at the bottom of the option page shows how the current option will affect your code.

Code Formatting options - CodeRush by DevExpress

CodeRush does not replace your habitual code formatting after installation. By default, CodeRush applies the specified formatting rules only to the code it generates. You can easily make CodeRush apply its formatting rules whenever Visual Studio active language service auto-formats the code. Check the Adjust code style on autoformat option on the Editor|Code Formatting|General options page.

Adjust code style on autoformat option - CodeRush by DevExpress

Code Cleanup

Have too much dirty code in your solution? Waste no time to look for redundant or cumbersome code constructs. Clean up your file, project, or solution in seconds with CodeRush. It analyzes the code and applies certain refactorings where needed.

Code Cleanup - CodeRush by DevExpress

To start cleanup, click the Cleanup button on the DXCore Visualize toolbar or choose the appropriate item from the Solution Explorer context menu.

Start cleanup - CodeRush by DevExpress

CodeRush offers you apply any of the following improvements to your code during cleanup. You can customize the cleanup options on the Editor|Code Cleanup|Code Cleanup option page.

  • Convert "" to string.Empty
  • Force braces in "do", "while" statements
  • Force braces in "fixed" statement
  • Force braces in "for", "foreach" statements
  • Force braces in "if..else" statement
  • Force braces in "using", "lock" statements
  • Make properties auto-implemented
  • Remove all comments, excluding XML comments
  • Remove all regions
  • Remove unreachable code
  • Remove unused namespace references
  • Remove unused variables
  • Remove user blocks
  • Sort enum elements
  • Use explicit internal modifier
  • Use explicit private modifier

If you check the Format Code option on the Editor|Code Cleanup|Code Cleanup options page, CodeRush applies formatting rules after cleanup has been performed.

Format Code option - CodeRush by DevExpress

LIVE CHAT

Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

FOLLOW US

DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2014 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners