Skip to content

Conversation

rcrews
Copy link
Contributor

@rcrews rcrews commented Feb 22, 2018

Warnings appear when running the sample code under QuickStart Guide to Using the AWS SDK for Ruby with warnings on:

#!/usr/bin/env/ruby -w
require 'aws-sdk-s3'  # v2: require 'aws-sdk'

s3 = Aws::S3::Resource.new(region: 'us-west-2')

s3.buckets.limit(50).each do |b|
  puts "#{b.name}"
end

The warnings are:

  • aws-sdk-core-3.16.0/lib/aws-sdk-core/rest/request/endpoint.rb:52: warning: shadowing outer local variable - parts
  • aws-sigv4-1.0.2/lib/aws-sigv4/signer.rb:441: warning: shadowing outer local variable - headers
  • aws-sdk-core-3.16.0/lib/seahorse/model/shapes.rb:39: warning: instance variable @location not initialized

These updates silence the warnings.

Fixes the following warning when run under -w:
  aws-sdk-core-3.16.0/lib/seahorse/model/shapes.rb:39:
    warning: instance variable @location not initialized
Fixes the following warning when run under -w:
  aws-sdk-core-3.16.0/lib/aws-sdk-core/rest/request/endpoint.rb:52:
    warning: shadowing outer local variable - parts
Fixes the following warning when run under -w:
  aws-sigv4-1.0.2/lib/aws-sigv4/signer.rb:441:
    warning: shadowing outer local variable - headers
@rcrews
Copy link
Contributor Author

rcrews commented Feb 22, 2018

The TravisCI test failure is on JRuby 9.1.5.0 only. My changes pass on all other Rubies. I am not able to reproduce the error on JRuby 9.1.16.0. I wonder if the problem is with JRuby 9.1.5.0 (and has since been fixed in 9.1.16.0)? The error relates to calling [] on a nil object, but the spec says @location should default to nil, which is why I used nil for the initialization. The TravisCI problem is at aws-sdk-s3/lib/aws-sdk-s3/object_multipart_copier.rb#L56. The changes in commits 572052a and 9d0343a are not failing.

Robert

@rcrews rcrews changed the title Fix qs ex1 warnings Fix QuickStart example #1 warnings Feb 23, 2018
rcrews and others added 22 commits March 2, 2018 17:52
Fixes the following warning when run under -w:
  aws-sdk-core-3.16.0/lib/seahorse/model/shapes.rb:39:
    warning: instance variable @location not initialized
Fixes the following warning when run under -w:
  aws-sdk-core-3.16.0/lib/aws-sdk-core/rest/request/endpoint.rb:52:
    warning: shadowing outer local variable - parts
Fixes the following warning when run under -w:
  aws-sigv4-1.0.2/lib/aws-sigv4/signer.rb:441:
    warning: shadowing outer local variable - headers
* Doc updates [ci skip]
* Allow  in shape names
* Update test with apig model
@rcrews
Copy link
Contributor Author

rcrews commented Mar 12, 2018

I reverted the commit that initialized the location field. I'll work on solving the warning in another way.

@awood45
Copy link
Contributor

awood45 commented Mar 12, 2018

Looks good, thanks!

@awood45 awood45 merged commit 072d2ed into aws:master Mar 12, 2018
@rcrews rcrews deleted the fix-qs-ex1-warnings branch March 13, 2018 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants