Reformat adds redundancies

Using v2 build 205 - I'm curious to know why sometimes, when I do a Reformat Code (with all three options checked) on green code (no warnings or errors), ReSharper introduces redundant qualifiers and redundant casts, which then display as warnings. For example, I am working in namespace Company.Division.App.Web, and I will typically write:

using Company.Division.App.Business;

ReSharper will flag this as a redundant qualifier, so I go ahead and remove it to give:

using Business;

Then I do a Reformat Code, and ReSharper changes this back to the full version. In another example, I am passing an enum parameter like so:

SomeObj o = new SomeObj(SomeEnum.SomeValue);

When I do a Reformat Code, ReSharper adds a type cast:

SomeObj o = new SomeObject((SomeEnum) SomeEnum.SomeValue);

I know I can turn off certain warnings, but I like clean code so I keep them on. Is there any way to prevent the Reformat function from introducing these redundancies?

2 comments
Comment actions Permalink

sorry - should have added that I am using RS for VS 2003

0
Comment actions Permalink

I've been reported of this problem a lot of times.
But I haven't yet managed to create a simpe stand-alone piece of code which
shows this problem - so I can't debug it :(:(:(

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Patrick Huffer" <no_mail@jetbrains.com> wrote in message
news:8663396.1124985283081.JavaMail.itn@is.intellij.net...

Using v2 build 205 - I'm curious to know why sometimes, when I do a
Reformat Code (with all three options checked) on green code (no warnings
or errors), ReSharper introduces redundant qualifiers and redundant casts,
which then display as warnings. For example, I am working in namespace
Company.Division.App.Web, and I will typically write:

>

using Company.Division.App.Business;

>

ReSharper will flag this as a redundant qualifier, so I go ahead and
remove it to give:

>

using Business;

>

Then I do a Reformat Code, and ReSharper changes this back to the full
version. In another example, I am passing an enum parameter like so:

>

SomeObj o = new SomeObj(SomeEnum.SomeValue);

>

When I do a Reformat Code, ReSharper adds a type cast:

>

SomeObj o = new SomeObject((SomeEnum) SomeEnum.SomeValue);

>

I know I can turn off certain warnings, but I like clean code so I keep
them on. Is there any way to prevent the Reformat function from
introducing these redundancies?



0

Please sign in to leave a comment.