diff options
author | Lamont Granquist <454857+lamont-granquist@users.noreply.github.com> | 2022-01-04 12:44:48 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-04 12:44:48 -0800 |
commit | f9fb231d9080192b31728d31c56de9d009941637 (patch) | |
tree | ed82f4b520ab81ad89bd5023f8d8c8d35a4f3205 /knife | |
parent | 8c5dbeb7609284f79d705e6ff0ac703bce0752ba (diff) | |
parent | f84a238a1d8d0060d5064eee0b74ed942088d4fd (diff) | |
download | chef-f9fb231d9080192b31728d31c56de9d009941637.tar.gz |
Merge pull request #12411 from chef/Performance_RegexpMatch
Diffstat (limited to 'knife')
-rw-r--r-- | knife/lib/chef/knife/core/gem_glob_loader.rb | 2 | ||||
-rw-r--r-- | knife/lib/chef/knife/core/subcommand_loader.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/knife/lib/chef/knife/core/gem_glob_loader.rb b/knife/lib/chef/knife/core/gem_glob_loader.rb index d365602cb4..afc1575f5e 100644 --- a/knife/lib/chef/knife/core/gem_glob_loader.rb +++ b/knife/lib/chef/knife/core/gem_glob_loader.rb @@ -62,7 +62,7 @@ class Chef # Exclude knife/chef/version. It's not a knife command, and force-loading # when we load all of these files will emit constant-already-defined warnings - next if rel_path =~ version_file_match + next if rel_path&.match?(version_file_match) subcommand_files[rel_path] = file end diff --git a/knife/lib/chef/knife/core/subcommand_loader.rb b/knife/lib/chef/knife/core/subcommand_loader.rb index d70ba11a59..ddcaeffd0c 100644 --- a/knife/lib/chef/knife/core/subcommand_loader.rb +++ b/knife/lib/chef/knife/core/subcommand_loader.rb @@ -151,7 +151,7 @@ class Chef rel_path = knife_file[/#{KNIFE_ROOT}#{Regexp.escape(File::SEPARATOR)}(.*)\.rb/, 1] # Exclude version.rb file for the gem. It's not a knife command, and force-loading it later # because loaded via in subcommand files generates CLI warnings about its consts already having been defined - next if knife_file =~ version_file_match + next if knife_file&.match?(version_file_match) subcommand_files[rel_path] = knife_file end |