Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] UseLocaleWithCaseConversions could check String.format #2584

Open
wuchiuwong opened this issue Jun 14, 2020 · 0 comments
Open

[java] UseLocaleWithCaseConversions could check String.format #2584

wuchiuwong opened this issue Jun 14, 2020 · 0 comments
Labels
an:enhancement An improvement on existing features / rules

Comments

@wuchiuwong
Copy link

wuchiuwong commented Jun 14, 2020

Affects PMD Version:
6.22.0

Rule:
UseLocaleWithCaseConversions

Description:
UseLocaleWithCaseConversions could additionally check String.format(foo, bar)
Similar to toLowerCase() and toUpperCase, String.format(foo, bar) also need to specify a locale when calling the methods

Code Sample demonstrating the suggestion:

capture = String.format("You zoomed in %.2f%%.\n", percent);

// better
capture = String.format(Locale.ROOT, "You zoomed in %.2f%%.\n", percent);

Type:
Suggestions for rule improvement

Running PMD through:
CLI

@wuchiuwong wuchiuwong added the an:enhancement An improvement on existing features / rules label Jun 14, 2020
@oowekyala oowekyala changed the title [java]It is recommended to have UseLocaleWithCaseConversions additionally check String.format(foo, bar) [java] UseLocaleWithCaseConversions could check String.format Jun 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
an:enhancement An improvement on existing features / rules
Projects
None yet
Development

No branches or pull requests

1 participant