Skip to content

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

Description

@3flex

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions