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

New lint rule that checks if a Tree is planted for atleast an app variant. #381

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

tikurahul
Copy link

  • Added tests for the lint rule.

@tikurahul tikurahul changed the title New lint rule that checks if a Tree for planted for an app variant. New lint rule that checks if a Tree is planted for atleast an app variant. Feb 20, 2020

class TimberIssueRegistry : IssueRegistry() {
override val api = CURRENT_API
override val minApi: Int = CURRENT_API
Copy link
Contributor

Choose a reason for hiding this comment

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

This is new. Not sure we want this.

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Owner

Choose a reason for hiding this comment

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

Tor said you should make it as low as you test: #329 (comment)

Copy link
Author

Choose a reason for hiding this comment

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

Done.

}

override fun afterCheckRootProject(context: Context) {
if (checkForPlantedTrees && !hasPlantedTree && context.driver.phase > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's context.driver.phase > 1 doing?

Copy link
Author

Choose a reason for hiding this comment

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

This is a 2 phase lint rule. The first phase checks for the use of Timber's logging APIs. Once we find instances of such use, we start phase 2 (line 52) to ensure that at least one Timber.Tree was planted.

The afterCheckRootProject callback is called at the end of every phase, and therefore we only want to report an issue, after 2 phases are complete.

@JakeWharton
Copy link
Owner

Thanks, Rahul. I'll see if we can get this in now that the project is back on its feet.

@tikurahul
Copy link
Author

Once you folks are happy with the PR, I can fix conflicts and re-upload. Please let me know.

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.

None yet

3 participants