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 StringFormatNoLocaleDetector #19

Merged
merged 3 commits into from
Oct 8, 2019
Merged

Conversation

ShaishavGandhi
Copy link
Collaborator

Adds a new lint-checks module for general Java/Kotlin lint rules.

private fun stringTypes() = setOf("java.lang.String",
"kotlin.String",
// Kotlin extension fully qualified name for kotlin.String.format
"kotlin.text.StringsKt__StringsJVMKt")
Copy link

Choose a reason for hiding this comment

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

Can this be resolved via getClass().getName() rather than hard coded?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think this is possible. The kotlin.String.format is implemented as an inline function. I don't really like this either.

The other option is to branch between Java and Kotlin for this. Check if String.format is implemented as extension and if so, check on the receiver.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 48ee982

@ShaishavGandhi ShaishavGandhi merged commit 37c65fe into master Oct 8, 2019
@ShaishavGandhi ShaishavGandhi deleted the sg/string-format-nolocale branch October 8, 2019 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants