diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-23 10:45:15 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-23 10:45:15 -0800 |
commit | 271d3e4f91e3d158c9112512ac75d0ca51fc928d (patch) | |
tree | 5beb5e5588db43ecac46f38725cabf5e573fd1d6 /lib/chef/knife | |
parent | aa7e0e05395823c66b30f1a810d1720aea3b6d72 (diff) | |
download | chef-271d3e4f91e3d158c9112512ac75d0ca51fc928d.tar.gz |
Autofixing new Perf cops in 0.37.2
6 Performance/Casecmp
18 Performance/Detect
1 Performance/RangeInclude
27 Performance/RedundantBlockCall
6 Performance/RedundantMatch
5 Performance/RedundantMerge
18 Performance/StringReplacement
Diffstat (limited to 'lib/chef/knife')
-rw-r--r-- | lib/chef/knife/cookbook_site_download.rb | 2 | ||||
-rw-r--r-- | lib/chef/knife/cookbook_site_show.rb | 2 | ||||
-rw-r--r-- | lib/chef/knife/core/bootstrap_context.rb | 5 | ||||
-rw-r--r-- | lib/chef/knife/core/subcommand_loader.rb | 2 | ||||
-rw-r--r-- | lib/chef/knife/search.rb | 2 | ||||
-rw-r--r-- | lib/chef/knife/ssh.rb | 2 |
6 files changed, 8 insertions, 7 deletions
diff --git a/lib/chef/knife/cookbook_site_download.rb b/lib/chef/knife/cookbook_site_download.rb index 2bdeea9781..21a251a011 100644 --- a/lib/chef/knife/cookbook_site_download.rb +++ b/lib/chef/knife/cookbook_site_download.rb @@ -102,7 +102,7 @@ class Chef end def specific_cookbook_version_url - "#{cookbooks_api_url}/#{@name_args[0]}/versions/#{@name_args[1].gsub('.', '_')}" + "#{cookbooks_api_url}/#{@name_args[0]}/versions/#{@name_args[1].tr('.', '_')}" end end end diff --git a/lib/chef/knife/cookbook_site_show.rb b/lib/chef/knife/cookbook_site_show.rb index a6a4c82c85..c0280cb318 100644 --- a/lib/chef/knife/cookbook_site_show.rb +++ b/lib/chef/knife/cookbook_site_show.rb @@ -33,7 +33,7 @@ class Chef when 1 noauth_rest.get("https://supermarket.chef.io/api/v1/cookbooks/#{@name_args[0]}") when 2 - noauth_rest.get("https://supermarket.chef.io/api/v1/cookbooks/#{@name_args[0]}/versions/#{name_args[1].gsub('.', '_')}") + noauth_rest.get("https://supermarket.chef.io/api/v1/cookbooks/#{@name_args[0]}/versions/#{name_args[1].tr('.', '_')}") end end diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb index b05cae688c..5379b6504c 100644 --- a/lib/chef/knife/core/bootstrap_context.rb +++ b/lib/chef/knife/core/bootstrap_context.rb @@ -171,9 +171,10 @@ validation_client_name "#{@chef_config[:validation_client_name]}" def first_boot (@config[:first_boot_attributes] || {}).tap do |attributes| if @config[:policy_name] && @config[:policy_group] - attributes.merge!(:policy_name => @config[:policy_name], :policy_group => @config[:policy_group]) + attributes[:policy_name] = @config[:policy_name] + attributes[:policy_group] = @config[:policy_group] else - attributes.merge!(:run_list => @run_list) + attributes[:run_list] = @run_list end attributes.merge!(:tags => @config[:tags]) if @config[:tags] && !@config[:tags].empty? diff --git a/lib/chef/knife/core/subcommand_loader.rb b/lib/chef/knife/core/subcommand_loader.rb index 95ab219c80..e636013c70 100644 --- a/lib/chef/knife/core/subcommand_loader.rb +++ b/lib/chef/knife/core/subcommand_loader.rb @@ -118,7 +118,7 @@ class Chef load_command(cmd_words) result = Chef::Knife.subcommands[find_longest_key(Chef::Knife.subcommands, cmd_words, "_")] - result || Chef::Knife.subcommands[args.first.gsub("-", "_")] + result || Chef::Knife.subcommands[args.first.tr("-", "_")] end def guess_category(args) diff --git a/lib/chef/knife/search.rb b/lib/chef/knife/search.rb index 30a3db3cf2..520c9273af 100644 --- a/lib/chef/knife/search.rb +++ b/lib/chef/knife/search.rb @@ -177,7 +177,7 @@ class Chef # See lib/chef/search/query.rb for more examples of this. def create_result_filter(filter_string) final_filter = Hash.new - filter_string.gsub!(" ", "") + filter_string.delete!(" ") filters = filter_string.split(",") filters.each do |f| return_id, attr_path = f.split("=") diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index 4184171a4e..9c0f8936f0 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -424,7 +424,7 @@ class Chef end.join(" \\; ") end - tmux_name = "'knife ssh #{@name_args[0].gsub(/:/, '=')}'" + tmux_name = "'knife ssh #{@name_args[0].tr(':', '=')}'" begin server = session.servers_for.first cmd = ["tmux new-session -d -s #{tmux_name}", |