Bug #3514

Unused Variable Warnings in StdLib [PATCHES]

Added by Run Paint Run Run almost 5 years ago. Updated almost 4 years ago.

Status:Closed
Priority:Low
Assignee:Marc-Andre Lafortune
ruby -v:ruby 1.9.3dev (2010-07-01 trunk 28516) [i686-linux] Backport:

Description

=begin
Quite a few files in lib/ trigger "assigned but unused variable" warnings. Attached are fixes for the first seven files. For all of them I've examined the local variable scope, and confirmed that neither the unit tests nor RubySpec breaks. If these are OK, I'll continue.
=end

date.patch Magnifier (1.57 KB) Run Paint Run Run, 07/02/2010 04:38 AM

debug.patch Magnifier (939 Bytes) Run Paint Run Run, 07/02/2010 04:38 AM

pathname.patch Magnifier (1.07 KB) Run Paint Run Run, 07/02/2010 04:38 AM

irb.patch Magnifier (1 KB) Run Paint Run Run, 07/02/2010 04:38 AM

logger.patch Magnifier (790 Bytes) Run Paint Run Run, 07/02/2010 04:38 AM

drb.patch Magnifier (1.41 KB) Run Paint Run Run, 07/02/2010 04:38 AM

csv.patch Magnifier (942 Bytes) Run Paint Run Run, 07/02/2010 04:38 AM

unused.patch Magnifier (36.5 KB) Run Paint Run Run, 07/14/2010 04:57 AM

History

#1 Updated by Marc-Andre Lafortune almost 5 years ago

=begin
attachments didn't make it...
=end

#2 Updated by Run Paint Run Run almost 5 years ago

=begin
Sorry. I'm in an area with "excellent" 3G coverage which drops out every ten minutes...
=end

#3 Updated by Marc-Andre Lafortune over 4 years ago

  • Target version set to 2.0.0

=begin
Thanks for the patches. They have been applied in r28619 .

Note that as all these changes are independent, breaking them in different patches is not needed; a single one is easier to apply.

To generate the warnings in an automatic fashion, one can issue the following command:

make test-all TESTS="test_library_loading.rb"

Where the file test/test_library_loading.rb is:

require 'test/unit'
require_relative 'ruby/envutil'

class TestRequire < Test::Unit::TestCase
exceptions = %w[rubygems/specification]
exclude = Regexp.union(exceptions.map{|p| Regexp.new "#{p}"})
root = "lib"
path = File.expand_path("../../#{root}/", FILE)
seen = []
Dir.chdir path
puts ENV['LOAD_ONLY'].inspect
load = if ENV['LOAD_ONLY']
ENV['LOAD_ONLY'].split(/,/)
else
Dir.glob("
/.rb")
end
load.each do |lib|
lib.chomp!(".rb")
next if exclude =~ lib
define_method :"test_load_library (#{root}/#{lib})" do
assert_in_out_err([], "$VERBOSE= true\nrequire '#{lib}'") do |stdout, stderr|
all = stdout+stderr
all -= seen
seen += all
fail "No output was expected but got:\n" + all.join("\n") unless all.empty?
pass
end
end
end
end

=end

#4 Updated by Run Paint Run Run over 4 years ago

=begin
The attached fixes the majority of the remainder. The residuum are used in a binding, so can't simply be removed. I suspect they can be replaced with ivars, but that'll be a separate ticket. RubySpec library/ still passes. I don't believe any of the test-all failures are my fault, but I'm currently re-building without my patch to check.
=end

#5 Updated by Marc-Andre Lafortune over 4 years ago

  • Status changed from Open to Assigned
  • Assignee set to Marc-Andre Lafortune

=begin

=end

#6 Updated by Marc-Andre Lafortune over 4 years ago

  • Status changed from Assigned to Closed

=begin
Thanks for the patch and sorry for the delay.

Applied in r29726, as well as r29725 downto r29722 for RubyGems, RDoc, Rake & minitest.
=end

#7 Updated by Ryan Davis over 4 years ago

=begin

On Nov 8, 2010, at 18:55 , Marc-Andre Lafortune wrote:

Issue #3514 has been updated by Marc-Andre Lafortune.

Status changed from Assigned to Closed

Thanks for the patch and sorry for the delay.

Applied in r29726, as well as r29725 downto r29722 for RubyGems, RDoc, Rake & minitest.

Please respect the warning at the top of the file:

############################################################

This file is imported from a different project.

DO NOT make modifications in this repo.

File a patch instead and assign it to Ryan Davis

############################################################

In this case, the patch will be rolled out because the file is getting an total revamp in the next merge.

The same should be true for rubygems, rdoc, and rake. It is much better to file a ticket against the maintainer and let them handle it rather than force them to deal with bi-directional merge conflicts across multiple repos.

=end

Also available in: Atom PDF