Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smart refactoring using Roslyn CTP [closed]

I'm running some analysis tools on our build like StyleCop/FXCop.

What i'd like to achieve is auto-correct some of the warnings produced by these.

Do you think this can be done using the Roslyn CTP? is there any other tool that allows:

  1. Scanning my code text for some rule not being followed.
  2. Replacing this with the correct code.

Some of the operations can be done using a simple text replace of the VS editor, but more complicated things require use of some other tool.

So my question is - to this end, is the Roslyn CTP the tool to use? or what other tools exist for .NET for doing this?

like image 263
lysergic-acid Avatar asked Dec 02 '11 06:12

lysergic-acid


2 Answers

This is certainly one of the scenarios that Roslyn addresses. Take a look at this walkthrough that demonstrates how to write a "Quick Fix" using Roslyn. In fact, the CTP also ships with a couple of samples that demonstrate how one could write stylecop / fxcop style rules using Roslyn.

You can also glance through this document for an overview of the overall scope of the CTP.

Disclaimer: I work for Microsoft on the Roslyn team.

like image 86
Shyam N Avatar answered Nov 17 '22 13:11

Shyam N


OP asks, "what other tools exist for .NET for doing this?"

Our DMS Software Reengineering Toolkit is a source-to-source program transformation tool.

DMS can parse, analyze, and transform source codes for many computer languages such as C++, Java, COBOL, and particularly including C#. It can also handle multiple languages simultaneously.

like image 26
Ira Baxter Avatar answered Nov 17 '22 12:11

Ira Baxter