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

IgnoredReturnValue should only report name of method/function called #3052

Closed
3flex opened this issue Sep 5, 2020 · 0 comments · Fixed by #3068
Closed

IgnoredReturnValue should only report name of method/function called #3052

3flex opened this issue Sep 5, 2020 · 0 comments · Fixed by #3068

Comments

@3flex
Copy link
Member

3flex commented Sep 5, 2020

Expected Behavior of the rule

IgnoredReturnValue message should only show the name of the call that did not have its return value checked, not the entire expression.

Context

IgnoredReturnValue is flagged for this code:

            .subscribe { recordList ->
                database.transaction {
                    database.zone_RecordQueries.delete_by_zone_id(domainName)
                    insertRows(recordList)
                }
            }

And the message reported is

The call subscribe { recordList ->
                database.transaction {
                    database.zone_RecordQueries.delete_by_zone_id(domainName)
                    insertRows(recordList)
                }
            } is returning a value that is ignored.

I think the message should change to show only subscribe in this case, since that's the name of the method that was called, and did not have it's return value checked. The contents of {} block is not relevant. Likewise for example observeOn(Schedulers.io()) only observeOn needs to be shown in the message.

@3flex 3flex changed the title IgnoredReturnValue should only show name of IgnoredReturnValue should only report name of method/function called Sep 5, 2020
@arturbosch arturbosch added this to the 1.14.0 milestone Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants