-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Ruby Warnings #191
Fix Ruby Warnings #191
Conversation
@@ -29,16 +29,17 @@ def initialize(name, | |||
@docstring = docstring | |||
@preset_labels = stringify_values(preset_labels) | |||
|
|||
@all_labels_preset = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: instance variable @all_labels_preset not initialized
if preset_labels.keys.length == labels.length | ||
@validator.validate_labelset!(preset_labels) | ||
@all_labels_preset = true | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this block up since it makes sense to have it closer to the other @label
variable definitions
|
||
v.each_with_object({}) do |(label_set, v), acc| | ||
values.each_with_object({}) do |(label_set, v), acc| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: shadowing outer local variable - v
|
||
result = v.each_with_object({}) do |(label_set, v), acc| | ||
result = values.each_with_object({}) do |(label_set, v), acc| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: shadowing outer local variable - v
actual_label_set = label_set.reject{|l| l == :le } | ||
acc[actual_label_set] ||= @buckets.map{|b| [b.to_s, 0.0]}.to_h | ||
acc[actual_label_set][label_set[:le].to_s] = v | ||
end | ||
|
||
result.each do |(label_set, v)| | ||
result.each do |(_label_set, v)| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: assigned but unused variable - label_set
I'm leaving the variable name, instead of setting to just _
to document what params are being passed here
@@ -74,6 +74,7 @@ def initialize(metric_name:, store_settings:, metric_settings:) | |||
@metric_name = metric_name | |||
@store_settings = store_settings | |||
@values_aggregation_mode = metric_settings[:aggregation] | |||
@store_opened_by_pid = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: instance variable @store_opened_by_pid not initialized
Our tests are running without outputting warnings, so we don't see a number of things Ruby was warning us about. All these code changes are effectively a NOOP. Signed-off-by: Daniel Magliola <dmagliola@crystalgears.com>
53259d8
to
db572f6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Our tests are running without outputting warnings, so we don't see a number
of things Ruby was warning us about.
All these code changes are effectively a NOOP.