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

Add DefaultLocale check #2343

Merged
merged 3 commits into from
Aug 3, 2022
Merged

Add DefaultLocale check #2343

merged 3 commits into from
Aug 3, 2022

Conversation

pkoenig10
Copy link
Member

Related to google/error-prone#632

Adds a DefaultLocale check that replaces uses of String.toLowerCase() and String.toUpperCase() with the overloads that take a Locale, using Locale.ROOT.

@changelog-app
Copy link

changelog-app bot commented Aug 2, 2022

Generate changelog in changelog/@unreleased

Type
See change types. Select one:

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Add DefaultLocale check

Related to google/error-prone#632

Adds a DefaultLocale check that replaces uses of String.toLowerCase() and String.toUpperCase() with the overloads that take a Locale, using Locale.ROOT.

Check the box to generate changelog(s)

  • Generate changelog entry

@pkoenig10 pkoenig10 requested a review from carterkozak August 2, 2022 21:56
@@ -38,6 +38,7 @@ public class BaselineErrorProneExtension {
"CompileTimeConstantViolatesLiskovSubstitution",
"ConsistentLoggerName",
"ConsistentOverrides",
"DefaultLocale",
Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Contributor

@carterkozak carterkozak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bulldozer-bot bulldozer-bot bot merged commit 369fbc0 into develop Aug 3, 2022
@bulldozer-bot bulldozer-bot bot deleted the pkoenig/locale branch August 3, 2022 00:41
@svc-autorelease
Copy link
Collaborator

Released 4.152.0

This was referenced Aug 3, 2022
bulldozer-bot bot pushed a commit to palantir/witchcraft-api that referenced this pull request Aug 8, 2022
###### _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 {
Copy link

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 ?

Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants