Project

General

Profile

Actions

Feature #8691

closed

Add warning for variable that is re-assigned but not re-used

Feature #8691: Add warning for variable that is re-assigned but not re-used

Added by agrimm (Andrew Grimm) about 12 years ago. Updated about 12 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:56184]

Description

The following code

def reassigned_unused
a = 42
b = a.to_s
a = 56
b
end

Does not currently generate an "assigned but unused variable" warning about the second assignment to "a".

Is it feasible to create a warning for such a scenario?

Updated by agrimm (Andrew Grimm) about 12 years ago Actions #1 [ruby-core:57091]

A third party tool that I use, called Rubocop, has implemented such functionality. https://github.com/bbatsov/rubocop/issues/458

So I don't really require this functionality in MRI any more.

Updated by zzak (zzak _) about 12 years ago Actions #2 [ruby-core:57238]

  • Status changed from Open to Feedback

@andrew should we close this ticket then?

Updated by agrimm (Andrew Grimm) about 12 years ago Actions #3 [ruby-core:57250]

Yes, close the ticket. If someone else wants the functionality, or has implemented the functionality and wants to submit a patch, they can open another ticket.

Updated by zzak (zzak _) about 12 years ago Actions #4 [ruby-core:57337]

  • Status changed from Feedback to Closed

closing, see ruby-core:57091

Actions

Also available in: PDF Atom