string.Format/CultureInfo/Internationalization in ReSharper

Now that 6.x is being worked on, I would like to re-raise the issue about
having ReSharper help with fixing an internationalization coding analysis
issue with string.Format() (and similar) methods:

I would like to have a quick-fix to insert the CultureInfo.InvariantCulture
or CultureInfo.CurrentCulture parameter quickly and easily.  And a
code-cleanup option perhaps.  Or an inspection or "hint" to always include
it (i.e. flag any uses of string.Format() and associated APIs that do not
specify a CultureInfo parameter).

Since this is one of the most common Code Analysis warnings I see, using
Visual Studio code analysis, it would be nice if ReSharper could help fix
all these issues up quickly.  I realize that it can't possibly "know" which
of two to use (Invariant or Current), but offering each as a quick-fix would
be very useful... and the option to have cleanup just use one or the other
(specified in the cleanup configuration, defaulting to off of course) would
be useful too... since for the most part, one file seems to have one method
in it (i.e. at least in my code, there isn't a lot of mixing).

Can this please be considered?

A similar quick-fix or flagging/hint/suggestion for string comparison type
parameters would be useful as well... these too are frequent Code Analysis
warnings.


2 comments

Hello Paul,

I assume you can get such hint and quick-fix already by creating corresponding
Structural Search and Replace patterns. If SSR doesn't cover your needs,
you're welcome to add a feature request through our tracker: http://youtrack.jetbrains.net/issues/RSRP.
Thank you!

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

Now that 6.x is being worked on, I would like to re-raise the issue
about having ReSharper help with fixing an internationalization coding
analysis issue with string.Format() (and similar) methods:

I would like to have a quick-fix to insert the
CultureInfo.InvariantCulture or CultureInfo.CurrentCulture parameter
quickly and easily.  And a code-cleanup option perhaps.  Or an
inspection or "hint" to always include it (i.e. flag any uses of
string.Format() and associated APIs that do not specify a CultureInfo
parameter).

Since this is one of the most common Code Analysis warnings I see,
using Visual Studio code analysis, it would be nice if ReSharper could
help fix all these issues up quickly.  I realize that it can't
possibly "know" which of two to use (Invariant or Current), but
offering each as a quick-fix would be very useful... and the option to
have cleanup just use one or the other (specified in the cleanup
configuration, defaulting to off of course) would be useful too...
since for the most part, one file seems to have one method in it (i.e.
at least in my code, there isn't a lot of mixing).

Can this please be considered?

A similar quick-fix or flagging/hint/suggestion for string comparison
type parameters would be useful as well... these too are frequent Code
Analysis warnings.



0

If it is possible to do such a thing with the current structural search and
replace, I cannot figure out how.  I find the current implementation really
far too limiting to do anything I've tried to do with it.  If you have any
guidelines on how to make it work correctly, I would like that... a
short-term helper would be good even if imperfect.

It seems a pretty obvious thing to add, given that one of the things
ReSharper is great at is fixing Code Analysis warnings... and assisting in
writing good internationalized (or internationalization-ready) code would be
a very good thing and a good selling point.

I have added an issue to the tracker.


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

Hello Paul,

I assume you can get such hint and quick-fix already by creating
corresponding
Structural Search and Replace patterns. If SSR doesn't cover your needs,
you're welcome to add a feature request through our tracker:
http://youtrack.jetbrains.net/issues/RSRP.
Thank you!

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

Now that 6.x is being worked on, I would like to re-raise the issue
about having ReSharper help with fixing an internationalization coding
analysis issue with string.Format() (and similar) methods:

>

I would like to have a quick-fix to insert the
CultureInfo.InvariantCulture or CultureInfo.CurrentCulture parameter
quickly and easily.  And a code-cleanup option perhaps.  Or an
inspection or "hint" to always include it (i.e. flag any uses of
string.Format() and associated APIs that do not specify a CultureInfo
parameter).

>

Since this is one of the most common Code Analysis warnings I see,
using Visual Studio code analysis, it would be nice if ReSharper could
help fix all these issues up quickly.  I realize that it can't
possibly "know" which of two to use (Invariant or Current), but
offering each as a quick-fix would be very useful... and the option to
have cleanup just use one or the other (specified in the cleanup
configuration, defaulting to off of course) would be useful too...
since for the most part, one file seems to have one method in it (i.e.
at least in my code, there isn't a lot of mixing).

>

Can this please be considered?

>

A similar quick-fix or flagging/hint/suggestion for string comparison
type parameters would be useful as well... these too are frequent Code
Analysis warnings.

>

0

Please sign in to leave a comment.