CodeRush 19.1.7

Adds new code analysis diagnostics, refactorings and cleanup rules.
August 07, 2019 - 9:27
New Version

Features

Diagnostics
This release gets the following code analysis diagnostics:

  • Unused local variable - identifies local variables which are never used in your code and can be safely deleted.
  • Local variable can be replaced with discard - identifies unused or assigned only variables which can be replaced with a discard.
  • Redundant field initialization - identifies redundant field initialization values which can be safely removed.
  • The type can be moved to a separate file - identifies types whose name differ from the file name. These types can be moved to a separate file (with the same name as the type) to improve code readability and discoverability.
  • The type name does not correspond to the file name - this issue appears in the Code Issues window if a type name does not match the name of the file that contains it.
  • Environment.NewLine can be used - identifies "\r\n" string values, which can be converted to Environment.NewLine calls.
  • String.Compare can be used - identifies string comparison expressions which can be replaced with a String.Compare call.
  • String.IsNullOrEmpty can be used - identifies expressions that test a string for null (or "Nothing" in Visual Basic) or an empty value, which can be replaced with a String.IsNullOrEmpty call.
  • String interpolation can be used - identifies composed string expressions which can be converted to interpolated strings.

Refactorings
New refactorings to help you remove unused variables from your code:

  • Remove Variable.
  • Remove Variable with its Initializer.
  • Remove Discard Variable.
  • Remove Discard Variable refactoring - replaces unused or assigned-only variables with discard.

Code Cleanups

  • New Cleanup Rules
    • You can use the Code Cleanup feature with the Remove unused variables rule to remove unused variables across multiple files at once.
    • The Replace unused variables with discard code cleanup rule replaces unused or assigned only variables with discard.
    • To apply these code cleanup refactorings, make sure the corresponding rules are enabled in the Editor | Language | Code Cleanup options page.
  • Run Code Cleanup for Folder
    • You can now run Code Cleanup for a selected folder (or folders) in the Solution Explorer. Simply right-click the folder you want to clean and select CodeRush Cleanup.
    • The progress window shows what files CodeRush is cleaning
    • If code cleanup is cancelled while it is still in progress, all code remains unchanged.

Code Places Enhancements

  • Favorite Code Places
    • You can favorite code places and access them instantly in the Favorites tab. Favorite places are saved between sessions.
    • To favorite a code place, right-click a desired member in the 'File Places' tab, select 'Add to Favorites' -> 'Add to new group' in the invoked context menu, enter a group name in the New Favorites Group dialog and press Enter.
    • CodeRush marks the favorite code place with a star and adds the code place to the newly-created group in the Favorites tab.
    • You can also add code places to different favorites groups. Right-click a code place in the 'File Places' tab, and select the desired group in the 'Add to Favorites' sub menu.
  • Collapse/Expand Code Places
    • The new Collapse All/Expand All buttons in the 'Code Places' window let you quickly collapse or expand all the code places and the corresponding members in the code editor.
  • Selection Expand/Reduce Enhancement
    • When using the Selection Expand/Reduce feature you can see a code preview in the code editor if a portion of the selected code falls outside the screen boundaries.
    • To enable this new code preview, go to the 'Editor | All Languages | Selection' options page and enable the "Show code preview hints when selection changes" option.

Fixes

  • Bookmarks - Bookmarks are not saved after changing the project properties.
  • Code Cleanup - Code cleanup incorrectly generates an explicit type name for the List<string> type.
  • Code Cleanup - Region directives are not properly indented when applying code cleanup.
  • Code Coverage - The Code Coverage window does not display the hierarchical tree of classes.
  • Navigation - "Jump to File" does not navigate to the correct recent item.
  • Performance - Slowdowns occur after the Visual Studio latest update.
  • Refactoring - The "Convert To Function" refactoring does not work for a local function.
New CodeRush code analysis diagnostics.

CodeRush

Visualize code and intuitively debug.

Got a Question?

Live Chat with our DevExpress licensing specialists now.