Skip to content

Commit

Permalink
Enable Performance/Sum
Browse files Browse the repository at this point in the history
  • Loading branch information
kaylareopelle committed Feb 24, 2023
1 parent b0a4177 commit 02b7aab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ Performance/StringIdentifierArgument: # new in 1.13
Enabled: true
Performance/StringInclude: # new in 1.7
Enabled: true
Performance/Sum: # new in 1.8
Enabled: true


# Old cops
Expand Down
7 changes: 0 additions & 7 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ Minitest/EmptyLineBeforeAssertionMethods:
- 'test/new_relic/agent_test.rb'
- 'test/new_relic/cli/commands/deployments_test.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: OnlySumOrWithInitialValue.
Performance/Sum:
Exclude:
- 'lib/new_relic/agent/system_info.rb'

# Offense count: 72
# This cop supports unsafe autocorrection (--autocorrect-all).
Performance/UnfreezeString:
Expand Down
2 changes: 1 addition & 1 deletion lib/new_relic/agent/system_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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, :+)
num_logical_processors = cores.values.sum

if num_physical_cores == 0
num_logical_processors = total_processors
Expand Down

0 comments on commit 02b7aab

Please sign in to comment.