Skip to content

Commit a171afb

Browse files
authored
Merge pull request #205 from rocketmobile/fix-warnings
fixup a few ruby warnings
2 parents f86255c + 78a73cd commit a171afb

File tree

6 files changed

+34
-12
lines changed

6 files changed

+34
-12
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313
/venv
1414
/lib/cassandra_murmur3.*
1515
/node_modules
16+
/*.gem
17+
/.bundle/*

CONTRIBUTING.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,30 @@
55
All code has bugs, but if you report them they can be squashed.
66

77
The best bug reports include everything that is needed to reliably reproduce the bug.
8+
9+
### Running the Test Suite
10+
811
Try to write a test case and include it in your report (have a look at the
9-
[regression test suite](spec/integration/regression_spec.rb) if you need inspiration).
10-
Submit defect reports to our [Jira](https://datastax-oss.atlassian.net/projects/RUBY/issues).
12+
[regression test suite](spec/regressions) if you need inspiration).
13+
14+
1. Bundle with `bundle install`
15+
1. Run the unit test suite with `rake rspec`
16+
* Using this rake task will install necessary ruby extensions as a prerequisite
17+
* For `bundle exec rspec` to be successful, run `bundle exec rake compile` once, beforehand
1118

1219
If it's not possible to write a test case, for example because the bug only happens in
13-
very particular circumstances, or is not deterministic, make sure you include as much
14-
information as you can about the situation. The version of the ruby driver is an absolute
15-
must, the version of Ruby and Cassandra are also very important. If there is a stack trace
16-
from the error make sure to include that (unfortunately the asynchronous nature of the
17-
ruby driver means that the stack traces are not always as revealing as they could be).
20+
very particular circumstances, or is not deterministic, please still report the bug!
21+
22+
### Opening a ticket
23+
24+
Submit defect reports to our [Jira](https://datastax-oss.atlassian.net/projects/RUBY/issues). Include:
25+
26+
* The `cassandra-driver` version (`bundle exec gem cassandra-driver -v`)
27+
* The Ruby version (`ruby -v`)
28+
* The Cassandra version (2nd line printed when running `cqlsh`)
29+
* A stack trace from the error, if there is one
1830

19-
##Pull Requests
31+
## Pull Requests
2032

2133
If you're able to fix a bug yourself, you can
2234
[fork the repository](https://help.github.com/articles/fork-a-repo/) and submit a

lib/cassandra/cluster/control_connection.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ def initialize(logger, io_reactor, cluster_registry, cluster_schema,
3636
@address_resolver = address_resolution_policy
3737
@connector = connector
3838
@connection_options = connection_options
39+
@connection = nil
3940
@schema_fetcher = schema_fetcher
4041
@refreshing_statuses = ::Hash.new(false)
42+
@refresh_schema_future = nil
4143
@status = :closed
4244
@refreshing_hosts = false
4345
@refreshing_host = ::Hash.new(false)

lib/cassandra/executors.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def initialize(size)
4343
@cond = new_cond
4444
@tasks = ::Array.new
4545
@waiting = 0
46-
@pool = ::Array.new(size, &method(:spawn_thread))
4746
@term = false
47+
@pool = ::Array.new(size, &method(:spawn_thread))
4848
end
4949

5050
def execute(*args, &block)

lib/cassandra/uuid/generator.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ def initialize(node_id = (::SecureRandom.random_number(2**47) | 0x010000000000),
4949
clock = ::Time)
5050
raise ::ArgumentError, 'invalid clock' unless clock.respond_to?(:now)
5151

52-
@node_id = Integer(node_id)
53-
@clock_id = Integer(clock_id)
54-
@clock = clock
52+
@node_id = Integer(node_id)
53+
@clock_id = Integer(clock_id)
54+
@clock = clock
55+
@last_usecs = nil
5556
end
5657

5758
# Returns a new UUID with a time component that is the current time.
@@ -82,6 +83,7 @@ def initialize(node_id = (::SecureRandom.random_number(2**47) | 0x010000000000),
8283
def now
8384
now = @clock.now
8485
usecs = now.to_i * 1_000_000 + now.usec
86+
8587
if @last_usecs && @last_usecs - @sequence <= usecs && usecs <= @last_usecs
8688
@sequence += 1
8789
elsif @last_usecs && @last_usecs > usecs
@@ -90,6 +92,7 @@ def now
9092
else
9193
@sequence = 0
9294
end
95+
9396
@last_usecs = usecs + @sequence
9497
from_usecs(@last_usecs)
9598
end

spec/spec_helper.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
require 'support/stub_io_reactor'
3434

3535
RSpec.configure do |config|
36+
# suppress ruby warnings
37+
config.warnings = false
38+
3639
config.expect_with(:rspec) do |c|
3740
c.syntax = [:should, :expect]
3841
end

0 commit comments

Comments
 (0)