Skip to content
This repository was archived by the owner on Jan 17, 2018. It is now read-only.

vbfox/KitsuneRoslyn

Repository files navigation

Kitsune Roslyn

Kitsune (狐) is the Japanese word for fox. Foxes are a common subject of Japanese folklore; in English, kitsune refers to them in this context. Stories depict them as intelligent beings and as possessing magical abilities that increase with their age and wisdom. Foremost among these is the ability to assume human form.

Wikipedia

Kitsune Roslyn is a compilation of Diagnostics for the C♯ language in Visual Studio 2015 made using Roslyn.
The extension is on the Gallery and can be installed directly in Visual Studio from the Tools | Extensions and Updates… menu.

Visual Studio 2015 support two different ways to allow code fixes in the light bulb:

  • Diagnostics created by inheriting DiagnosticAnalyzer. They can appear visually as squiggles in the editor and even when no squiggles are used the lightbulb appear in the margin when the cursor is over a potential fix.
  • Refactorings created by inheriting CodeRefactoringProvider. They never appear visually by themselves without being invoked with Ctrl+; but they can use the current selection of the user (Extract Method wouldn't be possible without it)

The choice was made for this library to implement the majority of it as Diagnostics for ease of use but it might be split latter in 2 versions if Diagnostics are slowing down Visual Studio too much.

Currently supported:

Conversion between the different type of properties

Documentation in progress…

Usage of var or type specified explicitly

Documentation in progress…

String formatting conversions

Convert from string.concat

This rule matches calls to string.Concat that provide strings or objects directly as argument.

The associated code fix suggest to replace it with either a single string if possible or with a call to string.Format.

Avoid string.Concat replace with string

Avoid string.Concat replace with string.Format

Default level: Warning

Convert from string concatenation

This rule matches concatenation of strings using the + operator.

The associated code fix suggest to replace it with either a single string if possible or with a call to string.Format.

Avoid string.Concat replace with string

Avoid string.Concat replace with string.Format

Default level: Hidden

Usage of canonical Empty values

Replace new Guid() with Guid.Empty

This rule matches calls to new Guid() and the associated code fix suggest to replace it with a call to Guid.Empty.

The rationale is that Guid.Empty is more expressive than the default constructor to represent a GUID with only zeroes inside.

Avoid new Guid()

Default level: Warning

Replace string.Empty with ""

This rule matches calls to string.Empty and the associated code fix suggest to replace it with the equivalent literal "".

The rationale is that there is no real reason for using string.Empty, the potential performance hit is insignificant and it is just a more verbose form of writing "".

Avoid String.Empty

Default level: Warning

About

A package of diagnostics and code fixes for refactoring.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors