Forum: Ruby-core [ruby-trunk - Feature #8691][Open] Add warning for variable that is re-assigned but not re-used

01bbb59a1c3ef9960f25a97afe7e920f?d=identicon&s=25 agrimm (Andrew Grimm) (Guest)
on 2013-07-26 01:53
(Received via mailing list)
Issue #8691 has been reported by agrimm (Andrew Grimm).

----------------------------------------
Feature #8691: Add warning for variable that is re-assigned but not
re-used
https://bugs.ruby-lang.org/issues/8691

Author: agrimm (Andrew Grimm)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:


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?
01bbb59a1c3ef9960f25a97afe7e920f?d=identicon&s=25 agrimm (Andrew Grimm) (Guest)
on 2013-09-10 01:26
(Received via mailing list)
Issue #8691 has been updated by agrimm (Andrew Grimm).


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.
----------------------------------------
Feature #8691: Add warning for variable that is re-assigned but not
re-used
https://bugs.ruby-lang.org/issues/8691#change-41701

Author: agrimm (Andrew Grimm)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:


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?
054b5f6b8afdd5f6190bad08e46cd782?d=identicon&s=25 zzak (Zachary Scott) (Guest)
on 2013-09-17 06:48
(Received via mailing list)
Issue #8691 has been updated by zzak (Zachary Scott).

Status changed from Open to Feedback

@andrew should we close this ticket then?
----------------------------------------
Feature #8691: Add warning for variable that is re-assigned but not
re-used
https://bugs.ruby-lang.org/issues/8691#change-41853

Author: agrimm (Andrew Grimm)
Status: Feedback
Priority: Normal
Assignee:
Category:
Target version:


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?
01bbb59a1c3ef9960f25a97afe7e920f?d=identicon&s=25 agrimm (Andrew Grimm) (Guest)
on 2013-09-18 00:37
(Received via mailing list)
Issue #8691 has been updated by agrimm (Andrew Grimm).


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.
----------------------------------------
Feature #8691: Add warning for variable that is re-assigned but not
re-used
https://bugs.ruby-lang.org/issues/8691#change-41869

Author: agrimm (Andrew Grimm)
Status: Feedback
Priority: Normal
Assignee:
Category:
Target version:


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?
054b5f6b8afdd5f6190bad08e46cd782?d=identicon&s=25 zzak (Zachary Scott) (Guest)
on 2013-09-23 22:07
(Received via mailing list)
Issue #8691 has been updated by zzak (Zachary Scott).

Status changed from Feedback to Closed

closing, see ruby-core:57091
----------------------------------------
Feature #8691: Add warning for variable that is re-assigned but not
re-used
https://bugs.ruby-lang.org/issues/8691#change-41944

Author: agrimm (Andrew Grimm)
Status: Closed
Priority: Normal
Assignee:
Category:
Target version:


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?
This topic is locked and can not be replied to.