Skip to content

Commit

Permalink
rubocop: introduce rubocop-performance (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak authored Sep 20, 2023
1 parent 47365d5 commit d434a4a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ inherit_from: .rubocop_todo.yml
require:
- rubocop-rails
- rubocop-capybara
- rubocop-performance

AllCops:
TargetRubyVersion: 3.2
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ group :linter do
gem 'rubocop-rails', '~> 2.21.1'
gem 'rubocop-rake', '~> 0.6.0'
gem 'rubocop-capybara', '~> 2.19.0'
gem 'rubocop-performance', '~> 1.19.0'
end

group :release do
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ GEM
parser (>= 3.2.1.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.21.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
Expand Down Expand Up @@ -481,6 +484,7 @@ DEPENDENCIES
rspec-openapi
rubocop (~> 1.56.3)
rubocop-capybara (~> 2.19.0)
rubocop-performance (~> 1.19.0)
rubocop-rails (~> 2.21.1)
rubocop-rake (~> 0.6.0)
ruby-saml
Expand Down
2 changes: 1 addition & 1 deletion app/models/hiera_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def search_key(hierarchy_name, key, facts: nil)
search_results[path] = {
file_present: file.exist?,
file_writable: file.writable?,
key_present: file.keys.include?(key),
key_present: file.keys.include?(key), # rubocop:disable Performance/InefficientHashSearch
replaced_from_git: file.replaced_from_git?,
value: file.content_for_key(key)
}
Expand Down
2 changes: 1 addition & 1 deletion app/models/hiera_data/hierarchy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def name
end

def lookup_function
@lookup_function ||= LOOKUP_FUNCTIONS.find { |f| raw_hash.keys.include?(f) }
@lookup_function ||= LOOKUP_FUNCTIONS.find { |f| raw_hash.keys.include?(f) } # rubocop:disable Performance/InefficientHashSearch
end

def backend
Expand Down

0 comments on commit d434a4a

Please sign in to comment.