Bug #3514
closedUnused Variable Warnings in StdLib [PATCHES]
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
Files
Updated by marcandre (Marc-Andre Lafortune) over 14 years ago
=begin
attachments didn't make it...
=end
Updated by runpaint (Run Paint Run Run) over 14 years ago
- File date.patch date.patch added
- File debug.patch debug.patch added
- File pathname.patch pathname.patch added
- File irb.patch irb.patch added
- File logger.patch logger.patch added
- File drb.patch drb.patch added
- File csv.patch csv.patch added
=begin
Sorry. I'm in an area with "excellent" 3G coverage which drops out every ten minutes...
=end
Updated by marcandre (Marc-Andre Lafortune) over 14 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
Updated by runpaint (Run Paint Run Run) over 14 years ago
- File unused.patch unused.patch added
=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
Updated by marcandre (Marc-Andre Lafortune) over 14 years ago
- Status changed from Open to Assigned
- Assignee set to marcandre (Marc-Andre Lafortune)
=begin
=end
Updated by marcandre (Marc-Andre Lafortune) about 14 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
Updated by zenspider (Ryan Davis) about 14 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