BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News The SharpDevelop Community Releases Refactoring Essentials 2

The SharpDevelop Community Releases Refactoring Essentials 2

This item in japanese

The SharpDevelop Community recently released version 2 of Refactoring Essentials for Visual Studio. The release brings new analyzers, new refactorings and several improvements to the Visual Studio extension. 

Refactoring Essentials is a rewrite of NRefactory, porting the features from a custom compiler to the C#/VB compiler platform Roslyn. Several changes were also made outside the implementation. Refactoring Essentials moved to a repository of it’s own, splitting from NRefactory. A new dedicated website was also published as part of the rewrite effort.

The version 2 brings several three new refactorings:

  • Put inside 'using'
  • Iterate via 'foreach'
  • Merge nested 'if'

It also brings eight new analyzers:

  • Redundant explicit size in array creation
  • Redundant comma in array initializer
  • Redundant base constructor call
  • Empty argument list is redundant
  • Local variable is never used
  • Parameter is assigned but its value is never used
  • Redundant condition check before assignment
  • Convert 'if...return' to 'return'

The image below shows an example of an analyzer suggesting to use the nameof operator of C# 6:


The C# version contains 96 refactorings and 102 analyzers. On the VB side, there are 16 refactorings and 2 analyzers. The complete list can be found on the Refactoring Essentials website.

The public release of Roslyn earlier this year made the implementation of code aware librairies in Visual Studio more accessible, removing the need of a custom or third party compiler to analyze C#/VB source code. Putting aside the features, Refactoring Essentials also provides an example of a live code aware library using the APIs of Roslyn by being open source.

Refactoring Essentials is available online as a Visual Studio 2015 extension. It is also available as a nuget package for build integration.

Rate this Article

Adoption
Style

BT