Broader code cleanup coverage

I've inherited a legacy winform app that I'm trying to clean up in advance of a major rewrite. It's a lot of code and I basically want code cleanup to go ahead with the hints, suggestion, warning, and error fixes as if I'd navigated to them, hit Alt+Enter, and hit return. In short, just do it all - I'll live with it if there are any issues once it's done. But if names are out of compliance with the current naming convention then how do I get it to just bulk rename on code clean up? Bulk apply all the hints and suggestions? I don't have time to Alt+Pgdn through tens of thousands of lines of code where the marker bar is solid red in file after file.

Am I missing something here? If so, please do advise as I'm not seeing it...

- Buried in crap in PDX

4 comments

Hello,

I'm afraid there's no way to invoke the default quick-fix for each warning
and suggestion in a solution from ReSharper UI. We're considering to include
naming style into code cleanup in one of the future releases, but as to other
warnings and suggestions the only way to invoke them automatically is to
write a plug-in for ReSharper which does that.

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I've inherited a legacy winform app that I'm trying to clean up in
advance of a major rewrite. It's a lot of code and I basically want
code cleanup to go ahead with the hints, suggestion, warning, and
error fixes as if I'd navigated to them, hit Alt+Enter, and hit
return. In short, just do it all - I'll live with it if there are any
issues once it's done. But if names are out of compliance with the
current naming convention then how do I get it to just bulk rename on
code clean up? Bulk apply all the hints and suggestions? I don't have
time to Alt+Pgdn through tens of thousands of lines of code where the
marker bar is solid red in file after file.

Am I missing something here? If so, please do advise as I'm not seeing
it...

- Buried in crap in PDX

---
Original message URL:
http://devnet.jetbrains.net/message/5298754#5298754



0

Hmm, ok, though it strikes me as a bit odd that you can list and / or highlight them all - i.e. you know what needs to be done - but there is no way to actually just do it batch? Seems very odd at best.

0

Hello,

You're right, ReSharper can find and highlight problems in your code, but
it can't automatically choose the best quick-fix. The cases when the quick-fix
is obvoius (such as redundant 'this' and unused 'using' directive etc) are
already part of code cleanup. Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Hmm, ok, though it strikes me as a bit odd that you can list and / or
highlight them all - i.e. you know what needs to be done - but there
is no way to actually just do it batch? Seems very odd at best.

---
Original message URL:
http://devnet.jetbrains.net/message/5298874#5298874



0

I get that there are some places where choices aren't obvious.

But in some it would seem to be clearcut - such as naming - can't you at the very least have a checkbox for code cleanup to clean the code into adherence with the naming standards? Or do all IsNullOrEmpty() swaps? Or swap out "" for string.Empty? What about all the FOREACH conversions? Or inverting IFs where the result would be a 'return' or a 'continue' under a FOR or FOREACH would be nice, as would marking methods STATIC when they can be. Etc., etc.

Those all seem like easy choices to me.

In my case I just inherited a million line Winform codebase with 10k line codebehinds which, in some cases, exhibit IF/SWITCH nesting eleven levels deep with 50-100 try-catch blocks - all these modules have solid red marker bars. Seems to me there is a certain amount of low hanging fruit still to be had that would greatly help developers who inherit such sad legacy codebases. Just making them reasonably legible and less inpenetrable would be an enormous help (even if I had to make a copy that the code cleanup broke, but that I could use as a reference point).

P.S. And it would be really nice if it could just go ahead and kill all the "if (someBool == false)" or "if (someBool == true)" so thoughts of suicide don't keep percolating to the surface...

0

Please sign in to leave a comment.