Bulk Hint Corrections

I love the ability to remove unused Using Statements, remove uncessecary fully qualified types and how Resharper inserts a using statement, how I can get rid of redundant qualifiers such as this. or whatever.

But it's a pain in the ass when you come across a crap load of code from somone or some place and you are clicking through the entire source code, in every class to get rid of them line by line.

Is there some kind of bulk ability to lets say remove all unused using statements in all classes
To remove redundant qualifiers in all classes

all that in one run?

This is taking me a long time to remove all the spaghetti code in some projects I've come across.

8 comments

Did you try ReSharper / Tools / Cleanup Code?

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


IR> I love the ability to remove unused Using Statements, remove
IR> uncessecary fully qualified types and how Resharper inserts a using
IR> statement, how I can get rid of redundant qualifiers such as this.
IR> or whatever.
IR>
IR> But it's a pain in the ass when you come across a crap load of code
IR> from somone or some place and you are clicking through the entire
IR> source code, in every class to get rid of them line by line.
IR>
IR> Is there some kind of bulk ability to lets say remove all unused
IR> using statements in all classes To remove redundant qualifiers in
IR> all classes
IR>
IR> all that in one run?
IR>
IR> This is taking me a long time to remove all the spaghetti code in
IR> some projects I've come across.
IR>
IR> ---
IR> Original message URL:
IR> http://devnet.jetbrains.net/message/5307716#5307716


0

Thanks for the reply.

Yes I have seen that before but I guess I was too scared to have that thing go through my entire codebase...I mean I'd rather actually be able to just go class by class but basically apply that cleanup per class...my choice rather than one huge swoop which could cause issues.

I will give that a try then.  The only question I have in that cleanup dialog are the 2 profiles and some options.

1) Arrange "this" qualifier

what do you mean by "arrange".  That is such a generic term.  Why not state it like "remove this qualifier".  So what does "arrange" mean in the context of cleanup for the this qualifier?

2) Remove Code Redundancies

ok again what's the guts behind this..the details.  What is this actually going to do.  What redundancies (uncessary use of object, ToString(), etc.?)..I don't want to just guess what this means to ReSharper

3) Optimize Using Statements

again what's "optimize" mean in this context?  Do you mean remove unused using statements?  If so, why not just state the option that way to be more specific so we know exactly what you mean by optimize

4) Reformat Code

again what does "reformat" mean in this context, what's it gonna reformat?!?

5) Shorten Qualified References

So does this essentially mean "Remove redundant/unecessary fully qualified types and replace it with a using statement?".  I have no idea what you mean here.


Now I don't know if maybe this is in your KB, I'll check but you can see where it makes me hesitant to use this tool outside the ones that "make sense" because they are stated well.   You made the others very obvious, e.g Use Auto Property, Use var declarations, ...those are clear to me and I think the rest should be more clear in this tool.

If I'm gonna use a tool that goes and makes bulk changes to my code, I want to know exactly what it's referring to instead of just generalized statements in a lot of cases listed in this cleanup tool.

Could you point me to a KB or explain what each means above and clarify for me berfore I run this cleanup tool?

And any way I can recommend a feature to run this cleanup on only specified classes or projects?

0

Hello,

Please take a look at http://www.jetbrains.com/resharper/webhelp/Code_Cleanup__Index.html.
Thank you!

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

Thanks for the reply.

Yes I have seen that before but I guess I was too scared to have that
thing go through my entire codebase...I mean I'd rather actually be
able to just go class by class but basically apply that cleanup per
class...my choice rather than one huge swoop which could cause issues.

I will give that a try then.  The only question I have in that cleanup
dialog are the 2 profiles and some options.

1) Arrange "this" qualifier

what do you mean by "arrange".  That is such a generic term.  Why not
state it like "remove this qualifier".  So what does "arrange" mean in
the context of cleanup for the this qualifier?

2) Remove Code Redundancies

ok again what's the guts behind this..the details.  What is this
actually going to do.  What redundancies (uncessary use of object,
ToString(), etc.?)..I don't want to just guess what this means to
ReSharper

3) Optimize Using Statements

again what's "optimize" mean in this context?  Do you mean remove
unused using statements?  If so, why not just state the option that
way to be more specific so we know exactly what you mean by optimize

4) Reformat Code

again what does "reformat" mean in this context, what's it gonna
reformat?!?

5) Shorten Qualified References

So does this essentially mean "Remove redundant/unecessary fully
qualified types and replace it with a using statement?".  I have no
idea what you mean here.

Now I don't know if maybe this is in your KB, I'll check but you can
see where it makes me hesitant to use this tool outside the ones that
"make sense" because they are stated well.   You made the others very
obvious, e.g Use Auto Property, Use var declarations, ...those are
clear to me and I think the rest should be more clear in this tool.

If I'm gonna use a tool that goes and makes bulk changes to my code, I
want to know exactly what it's referring to instead of just
generalized statements in a lot of cases listed in this cleanup tool.

Coulds you point me to a KB or explain what each means above and
clarify for me berfore I run this cleanup tool?

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



0

I use this all the time, and it's quite safe and convenient.

The one thing I wish was also available though (Pay attention Andrew
Serebryansky!) is additional redundant code removal, like "Redundant Else".
I had some old code that had about 40 instances of "if (blah) return x else
return y", and had to manually click "remove redundant else" 40 times,
because I couldn't find any cleanup code setting that would automate it.



"CoffeeAddict"  wrote in message
news:6901308.202391309360811152.JavaMail.devnet@confluence.jetbrains.net...

Thanks for the reply.

Yes I have seen that before but I guess I was too scared to have that thing
go through my entire codebase...I mean I'd rather actually be able to just
go class by class but basically apply that cleanup per class...my choice
rather than one huge swoop which could cause issues.

I will give that a try then.  The only question I have in that cleanup
dialog are the 2 profiles and some options.

1) Arrange "this" qualifier

what do you mean by "arrange".  That is such a generic term.  Why not state
it like "remove this qualifier".  So what does "arrange" mean in the context
of cleanup for the this qualifier?

2) Remove Code Redundancies

ok again what's the guts behind this..the details.  What is this actually
going to do.  What redundancies (uncessary use of object, ToString(),
etc.?)..I don't want to just guess what this means to ReSharper

3) Optimize Using Statements

again what's "optimize" mean in this context?  Do you mean remove unused
using statements?  If so, why not just state the option that way to be more
specific so we know exactly what you mean by optimize

4) Reformat Code

again what does "reformat" mean in this context, what's it gonna reformat?!?

5) Shorten Qualified References

So does this essentially mean "Remove redundant/unecessary fully qualified
types and replace it with a using statement?".  I have no idea what you mean
here.


Now I don't know if maybe this is in your KB, I'll check but you can see
where it makes me hesitant to use this tool outside the ones that "make
sense" because they are stated well.   You made the others very obvious, e.g
Use Auto Property, Use var declarations, ...those are clear to me and I
think the rest should be more clear in this tool.

If I'm gonna use a tool that goes and makes bulk changes to my code, I want
to know exactly what it's referring to instead of just generalized
statements in a lot of cases listed in this cleanup tool.

Coulds you point me to a KB or explain what each means above and clarify for
me berfore I run this cleanup tool?

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

0

I would love to see "remove redundant else" added to this... but also it
would be nice to have a feature I've requested since version 1.x:  "Fix all
like this", so I can click on a redundant else, and with one click, fix all
redundant elses in the file.  :)


"Andrew Serebryansky"  wrote in message
news:c8a898dd19b9a8ce0547f7dc916e@news.intellij.net...

Hello,

Please take a look at
http://www.jetbrains.com/resharper/webhelp/Code_Cleanup__Index.html.
Thank you!

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

Thanks for the reply.

>

Yes I have seen that before but I guess I was too scared to have that
thing go through my entire codebase...I mean I'd rather actually be
able to just go class by class but basically apply that cleanup per
class...my choice rather than one huge swoop which could cause issues.

>

I will give that a try then.  The only question I have in that cleanup
dialog are the 2 profiles and some options.

>

1) Arrange "this" qualifier

>

what do you mean by "arrange".  That is such a generic term.  Why not
state it like "remove this qualifier".  So what does "arrange" mean in
the context of cleanup for the this qualifier?

>

2) Remove Code Redundancies

>

ok again what's the guts behind this..the details.  What is this
actually going to do.  What redundancies (uncessary use of object,
ToString(), etc.?)..I don't want to just guess what this means to
ReSharper

>

3) Optimize Using Statements

>

again what's "optimize" mean in this context?  Do you mean remove
unused using statements?  If so, why not just state the option that
way to be more specific so we know exactly what you mean by optimize

>

4) Reformat Code

>

again what does "reformat" mean in this context, what's it gonna
reformat?!?

>

5) Shorten Qualified References

>

So does this essentially mean "Remove redundant/unecessary fully
qualified types and replace it with a using statement?".  I have no
idea what you mean here.

>

Now I don't know if maybe this is in your KB, I'll check but you can
see where it makes me hesitant to use this tool outside the ones that
"make sense" because they are stated well.   You made the others very
obvious, e.g Use Auto Property, Use var declarations, ...those are
clear to me and I think the rest should be more clear in this tool.

>

If I'm gonna use a tool that goes and makes bulk changes to my code, I
want to know exactly what it's referring to instead of just
generalized statements in a lot of cases listed in this cleanup tool.

>

Coulds you point me to a KB or explain what each means above and
clarify for me berfore I run this cleanup tool?

>

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


0

Yea what's up with not including remove redundant else and fix like this?  That would be an astronomical improvement to this cleanup tool.  I am removing redundant else hudreds of places in projects.

0

Hey anyone know if ReSharper has a page where you can submit Feature Requests?

0

Here's the link that explains and answers my original post

http://www.jetbrains.com/resharper/webhelp/Code_Cleanup__Creating_Custom_Profiles.html

I think it's strange that the grid on that page which explains what each cleanup action does is on a page called "Creating Custom Profiles".  Shouldn't this be extracted out into one of the core pages of Cleanup Help so it's more easily discoverable!

0

Please sign in to leave a comment.