Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refactoring of .NET code to comply with coding standards

we have a code base (VB.NET and C#) and a new coding standard. Do you have suggestions of tools that can move through a project and rename parameters/fields/properties/metothods etc according to the new coding standard.

It might for example need to change parameters into camel-case etc. One would imagine that parameters and local fields/variables are more easily renamed due to their local scope. I have looked at ReSharper but haven't found that it performs this task.

like image 522
nobba Avatar asked Oct 08 '12 13:10

nobba


People also ask

What is code refactoring in C#?

This refactoring allows you to modify a method signature in the following ways: Add, remove, rename, or reorder parameter(s) Change return type. Change parameter type(s) Rename method.

How do I enforce coding standards in visual studio?

Use an EditorConfig file when you want to enforce coding styles for all contributors to your repo or project. You can manually populate your EditorConfig file, or you can automatically generate the file based on the code style settings you've chosen in the Visual Studio Options dialog box.

What is the code to refactor code in Visual Studio?

Clicking on the Code Action lightbulb or using the Quick Fix command Ctrl+. will display Quick Fixes and refactorings. If you'd just like to see refactorings without Quick Fixes, you can use the Refactor command (Ctrl+Shift+R).


1 Answers

Sounds like a job for ReSharper with the StyleCop plugin. Here's an example:

Parameters name camelCasing :

enter image description here

fields renaming :

enter image description here

Solution Cleanup :

enter image description here

like image 81
Nasreddine Avatar answered Sep 28 '22 03:09

Nasreddine