diff options
author | Tim Smith <tsmith84@gmail.com> | 2021-09-13 16:49:22 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2021-09-13 16:49:22 -0700 |
commit | 289ec8bc61cc91841f1dcac1eed0a2c436992ff5 (patch) | |
tree | f2223bb875483435f2ccbf22f5c34d3c403b91de | |
parent | bee6130ca1398b02b18198578cc9de28cf46483d (diff) | |
download | chef-289ec8bc61cc91841f1dcac1eed0a2c436992ff5.tar.gz |
Resolve chefstyle warnings
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/resource/file/verification/yaml.rb | 12 | ||||
-rw-r--r-- | spec/unit/resource/file/verification/yaml_spec.rb | 6 |
2 files changed, 8 insertions, 10 deletions
diff --git a/lib/chef/resource/file/verification/yaml.rb b/lib/chef/resource/file/verification/yaml.rb index 7292f59b15..b7f2d758a3 100644 --- a/lib/chef/resource/file/verification/yaml.rb +++ b/lib/chef/resource/file/verification/yaml.rb @@ -39,13 +39,11 @@ class Chef provides :yaml def verify(path, opts = {}) - begin - Psych.parse_file(path) - return true - rescue Psych::SyntaxError => e - Chef::Log.error("Yaml syntax verify failed with : #{e.message}") - return false - end + Psych.parse_file(path) + true + rescue Psych::SyntaxError => e + Chef::Log.error("Yaml syntax verify failed with : #{e.message}") + false end end end diff --git a/spec/unit/resource/file/verification/yaml_spec.rb b/spec/unit/resource/file/verification/yaml_spec.rb index c7fdf42faf..390e52e316 100644 --- a/spec/unit/resource/file/verification/yaml_spec.rb +++ b/spec/unit/resource/file/verification/yaml_spec.rb @@ -28,7 +28,7 @@ describe Chef::Resource::File::Verification::Yaml do svc: mysqlPassword: sepppasswd ") - f.close() + f.close @invalid_yaml = "invalid-#{Time.now.to_i}.yaml" f = File.new(@invalid_yaml, "w") @@ -36,10 +36,10 @@ describe Chef::Resource::File::Verification::Yaml do svc: mysqlPassword: 'sepppasswd ") - f.close() + f.close @empty_yaml = "empty-#{Time.now.to_i}.yaml" - File.new(@empty_yaml, "w").close() + File.new(@empty_yaml, "w").close end context "verify" do |