Skip to content

deadcode includes methods referenced (called) as symbols #727

@corsonknowles

Description

@corsonknowles

Describe the bug

In this example, the method type_updated? will be flagged as unused, despite being called as a proc.

after_update :notify, if: :type_updated?

def type_updated?
  # contents irrelevant
end

def notify
  # this is a placeholder to demonstrate the issue.
end 

The commonness of this pattern means that deadcode results can be flooded with these examples.

To Reproduce
Spoom v1.6.1

See above code snippet, add it to to any Rails model

Run bundle exec spoom deadcode

Expected behavior
Symbolic references to a method mean that it will be considered used.

For deadcode output, this change would mean the method will be

  1. Excluded (works fine for my purposes), or
  2. Moved to a separate report section, or
  3. Configurable as to whether or not it appears in the report (and excluded by default)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp-wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions