-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Fragment] Add lint warning for calling LayoutInflater.from() in DialogFragment #156
Conversation
Hey 👋🏻 @jbw0033 |
fragment/fragment-lint/src/main/java/androidx/fragment/lint/UseGetLayoutInflater.kt
Outdated
Show resolved
Hide resolved
fragment/fragment-lint/src/main/java/androidx/fragment/lint/UseGetLayoutInflater.kt
Outdated
Show resolved
Hide resolved
fragment/fragment-lint/src/test/java/androidx/fragment/lint/UseGetLayoutInflaterTest.kt
Show resolved
Hide resolved
fragment/fragment-lint/src/test/java/androidx/fragment/lint/UseGetLayoutInflaterTest.kt
Outdated
Show resolved
Hide resolved
fragment/fragment-lint/src/test/java/androidx/fragment/lint/UseGetLayoutInflaterTest.kt
Outdated
Show resolved
Hide resolved
fragment/fragment-lint/src/test/java/androidx/fragment/lint/UseGetLayoutInflaterTest.kt
Outdated
Show resolved
Hide resolved
fragment/fragment-lint/src/test/java/androidx/fragment/lint/UseGetLayoutInflaterTest.kt
Outdated
Show resolved
Hide resolved
fragment/fragment-lint/src/test/java/androidx/fragment/lint/UseGetLayoutInflaterTest.kt
Outdated
Show resolved
Hide resolved
Thanks for the review 💙 |
Interesting that the PR base sha ( |
I updated the code, tested it on the |
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.
There is trailing white space in a lot the code stubs that needs to be removed. It is hard to highlight in github review but I will mark the lines. Sorry ahead of time for all the comments.
Proposed Changes
Lint check for detecting calls to
android.view.LayoutInflater.from
while being invoked from DialogFragment.For Java it allows autofix but for Kotlin it does not, just shows the lint warning. For Kotlin I could not get arguments which is passed to
from
method to create proper autofix. Java PSI is much easier for such tasks.Testing
Test: ./gradlew fragment:fragment-lint:test
Issues Fixed
Implements: The feature request on https://issuetracker.google.com/issues/170781346 being implemented