-
Notifications
You must be signed in to change notification settings - Fork 600
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
Rubocops compatible with Ruby 2.4+ #1840
Conversation
4474626
to
02b7aab
Compare
When FetchEnvVar fails, a KeyError or the explicitly specified default value is returned. We don't want to raise an unexpected error in a customer's environment. Also, fetch is slightly less performant than ENV[]
@kaylareopelle perhaps it's an issue best left for a separate PR, but my preference would be that for everywhere we now plan to align with the defaults, we would simply remove the |
I'm comfortable with that change. I'm not sure if all of these are on by default. I'll check Rubocop and adjust accordingly. I think makes sense to add another issue to adjust the other cops, since some of the enabled cops may be disabled by default. |
@@ -128,7 +128,7 @@ def self.parse_cpuinfo(cpuinfo) | |||
|
|||
num_physical_packages = cores.keys.map(&:first).uniq.size | |||
num_physical_cores = cores.size | |||
num_logical_processors = cores.values.reduce(0, :+) |
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.
This cop is unsafe if sum is called on an object that doesn't have a sum method, such as a String. cores.values
should always be an array of integers based on the default values of the Hash defined on line 110
lib/new_relic/agent/instrumentation/action_controller_other_subscriber.rb
Outdated
Show resolved
Hide resolved
…ruby-agent into rubocop-ruby24-compat
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.
🎉
SimpleCov Report
|
Overview
Our agent's previous support of Ruby 2.2 and 2.3 prevented some Rubocop linters from being enabled. This PR enables the following:
It disables Style/FetchEnvVar. When
ENV.fetch
fails, aKeyError
or the explicitly specified defaultvalue is returned. We don't want to raise an unexpected error in a customer's environment. Also, fetch is slightly less performant than
ENV[]
when there is not a non-nil replacement value.Resolves: #1787
Resolves: #1246