Skip to content
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

Merged
merged 1 commit into from
Jun 28, 2020
Merged

Fix Ruby Warnings #191

merged 1 commit into from
Jun 28, 2020

Conversation

dmagliola
Copy link
Collaborator

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.

@@ -29,16 +29,17 @@ def initialize(name,
@docstring = docstring
@preset_labels = stringify_values(preset_labels)

@all_labels_preset = false
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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|
Copy link
Collaborator Author

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|
Copy link
Collaborator Author

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)|
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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>
@dmagliola dmagliola force-pushed the fix_all_labels_preset_warning branch from 53259d8 to db572f6 Compare May 26, 2020 18:53
@coveralls
Copy link

coveralls commented May 26, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling db572f6 on fix_all_labels_preset_warning into 204d8c9 on master.

Copy link
Member

@Sinjo Sinjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dmagliola dmagliola merged commit 23418c2 into master Jun 28, 2020
@dmagliola dmagliola deleted the fix_all_labels_preset_warning branch June 28, 2020 18:28
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.

3 participants