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

[Fragment] Add lint warning for calling LayoutInflater.from() in DialogFragment #156

Closed

Conversation

tatocaster
Copy link
Contributor

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

@tatocaster
Copy link
Contributor Author

tatocaster commented Apr 7, 2021

Hey 👋🏻 @jbw0033
Check is failing with the error fatal: Invalid revision range d37bbbf988267d6ac43a467240aab5336cefd883..HEAD
Could you please take a look at it or rerun it again?

@tatocaster tatocaster changed the title Add lint warning for calling LayoutInflater.from() in DialogFragment [Fragment] Add lint warning for calling LayoutInflater.from() in DialogFragment Apr 7, 2021
@jbw0033
Copy link

jbw0033 commented Apr 8, 2021

Hey 👋🏻 @jbw0033
Check is failing with the error fatal: Invalid revision range d37bbbf988267d6ac43a467240aab5336cefd883..HEAD
Could you please take a look at it or rerun it again?

@dlam ideas on whats going on here?

@tatocaster
Copy link
Contributor Author

Thanks for the review 💙

@dlam
Copy link
Member

dlam commented Apr 8, 2021

Interesting that the PR base sha (d37bbb) from the github's PR event doesn't exist in our history.. I'll take a look to see where d37bbbf988267d6ac43a467240aab5336cefd883 is coming from. Sorry for the hassle here - you can test locally with ./gradlew bOS within the fragment project dir.

@tatocaster
Copy link
Contributor Author

I updated the code, tested it on the bOS task, and looks good.

Copy link

@jbw0033 jbw0033 left a 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.

@tatocaster
Copy link
Contributor Author

@dlam @jbw0033 thanks for the review 🙏

@tatocaster tatocaster deleted the feature/170781346 branch April 15, 2021 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants