views:

255

answers:

4

I've got some code I'm maintaining that has a good deal of machine generated comments and machine generated regions. (or created by a particularly misled developer)

These are comments exclusively repeating the method metadata and space expansions of pascal cased names:

#region methods
/// <summary>
/// Implementation of a public method foo bar, returning a void
/// </summary>
/// <param name="value">A string parameter named value input</param>
public void fooBar(string valueInput)
{

}
#endregion

Is there a plug in or feature of Resharper for stripping out the comments and #region tags in bulk?

+3  A: 

Why not use the regex find & replace in Visual Studio?

For triple slash comments:

    ///.*

For region tags:

    [#]region.*
    [#]endregion
Gavin Miller
Works perfectly, thanks!
MatthewMartin
+1  A: 

These parts were likely hand-typed:

Implementation of a public method foo bar, returning a void

and

A string parameter named value input

If this is in a class library project, I wouldn't get rid of the xml comments - they are what will show up in the intellisense prompts for those items. Removing them could make other developers very mad at you; for all the text here isn't very good, the default prompts are cryptic and even worse.

Joel Coehoorn
I know, I hand typed them. I'm not going to publish real source code on SO. I'm the only developer. Intellisense already provides meta-data on uncommented methods.
MatthewMartin
Agree in general, but in this context I don't think the XML comments are adding much. It really should say more about what its doing.
Martin Clarke
+1  A: 

I'd say replacing them with something more sensible is much better than stripping them out. As mundane as they may be, having no comments is always worse (unless the comments are incorrect of course? Then no comments is certainly better) :-)

That said, I believe this does what you're looking for.

For region tags, you could try adapting that app or using VS' regex find/replace.

Matthew Brindley
+1  A: 

I vote that you go in and fix them as you come across them. I've had to do the same thing here... every time that I go into a class that has bad comments (in my case: none). I comment the methods/properties as I work with them. After 3 weeks, I've properly commented about 1/2 the codebase and have developed a stronger understanding of the entire project.

SnOrfus