-
Notifications
You must be signed in to change notification settings - Fork 134
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
Add DefaultLocale check #2343
Add DefaultLocale check #2343
Conversation
Generate changelog in
|
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/DefaultLocale.java
Outdated
Show resolved
Hide resolved
@@ -38,6 +38,7 @@ public class BaselineErrorProneExtension { | |||
"CompileTimeConstantViolatesLiskovSubstitution", | |||
"ConsistentLoggerName", | |||
"ConsistentOverrides", | |||
"DefaultLocale", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially, let’s make this check a suggestion, and not add it to this list. We can spin up an excavator to roll out the suggested fix asynchronously, otherwise some baseline upgrades will be blocked on a way that we aren’t currently prepared to handle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On us to build a better ratcheting rollout mechanism in the medium term
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it feels a bit pointless to write these error-prone checks if we're too worried about blocking upgrades to actually enforce them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends on the criticality of the finding. I suspect this will find a lot of things that aren’t going to cause issues in practice. I agree we should fix them, but we have other work in flight that isn’t worth risking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
fd93165
to
e0526ce
Compare
Released 4.152.0 |
###### _excavator_ is a bot for automating changes across repositories. Changes produced by the roomba/latest-baseline-oss check. # Release Notes ## 4.152.0 | Type | Description | Link | | ---- | ----------- | ---- | | Feature | Add DefaultLocale check<br><br>Related to https://github.com/google/error-prone/issues/632<br><br>Adds a `DefaultLocale` check that replaces uses of `String.toLowerCase()` and `String.toUpperCase()` with the overloads that take a `Locale`, using `Locale.ROOT`. | palantir/gradle-baseline#2343 | ## 4.153.0 | Type | Description | Link | | ---- | ----------- | ---- | | Fix | Set the java launcher for Checkstyle tasks, too | palantir/gradle-baseline#2351 | To enable or disable this check, please contact the maintainers of Excavator.
summary = "Implicit use of the platform default locale, which can result in differing behaviour between JVM" | ||
+ " executions.", | ||
severity = SeverityLevel.SUGGESTION) | ||
public final class DefaultLocale extends BugChecker implements BugChecker.MethodInvocationTreeMatcher { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this add a check withi same name as, similar spirit to, but different implementation from https://errorprone.info/bugpattern/DefaultLocale ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see it's removed -- #2839
Related to google/error-prone#632
Adds a
DefaultLocale
check that replaces uses ofString.toLowerCase()
andString.toUpperCase()
with the overloads that take aLocale
, usingLocale.ROOT
.