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

rubocop: introduce rubocop-performance #182

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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