Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1775

Make driver Ruby warning-clean

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 2.19.0
    • Affects Version/s: 2.7.1
    • Component/s: None
    • Environment:
      ruby 2.6.1
    • Fully Compatible

      Currently the driver produces a number of warnings when run with `ruby -w`. For example, simply loading the driver produces the following output:

      speed% irb -Ilib -rmongo -w
      /home/w/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bson-4.4.2/lib/bson/decimal128/builder.rb:187: warning: assigned but unused variable - original
      /home/w/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bson-4.4.2/lib/bson/decimal128/builder.rb:188: warning: assigned but unused variable - e
      /home/w/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bson-4.4.2/lib/bson/decimal128/builder.rb:189: warning: assigned but unused variable - decimal
      /home/w/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bson-4.4.2/lib/bson/decimal128/builder.rb:315: warning: assigned but unused variable - base
      /home/w/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bson-4.4.2/lib/bson_native.so: warning: method redefined; discarding old next_object_id
      /home/w/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/bson-4.4.2/lib/bson/object_id.rb:356: warning: previous definition of next_object_id was here
      /home/w/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/mongo-2.8.0/lib/mongo/cluster/topology/base.rb:81: warning: assigned but unused variable - address_str
      /home/w/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/mongo-2.8.0/lib/mongo/cluster/sdam_flow.rb:317: warning: assigned but unused variable - address_strs
      /home/w/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/mongo-2.8.0/lib/mongo/server/connection.rb:223: warning: assigned but unused variable - rtt
      /home/w/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/mongo-2.8.0/lib/mongo/server/monitor.rb:234: warning: assigned but unused variable - average_rtt
      /home/w/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/mongo-2.8.0/lib/mongo/uri.rb:221: warning: assigned but unused variable - remaining
      /home/w/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/mongo-2.8.0/lib/mongo/uri.rb:819: warning: mismatched indentations at 'end' with 'def' at 811
      irb(main):001:0> 
      

      There are other warnings produced by the driver including the following:

      in sdam_flow.rb, line 416, there is a check against @need_topology_changed_event, but that variable isn't always initialized, which results in a warning:

      "lib/mongo/cluster/sdam_flow.rb:416: warning: instance variable @need_topology_changed_event not initialized"

            Assignee:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Reporter:
            idoa01 Ido Abramovich
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: