diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-03-14 10:34:33 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-03-14 10:34:33 -0700 |
commit | 6705acbd7f301d1b04388043a3dfa0308655f120 (patch) | |
tree | 1e8a43b35ef1684a4b90578f1a6374758aa7e3c7 /lib/chef/formatters | |
parent | 365064280c93d519fdacbf032c0c21057e5549c9 (diff) | |
download | chef-6705acbd7f301d1b04388043a3dfa0308655f120.tar.gz |
chefstyle Style/AndOr fixes
this is part of our informal style guide, lets make it formal since
clearly its not getting followed very well.
Diffstat (limited to 'lib/chef/formatters')
-rw-r--r-- | lib/chef/formatters/base.rb | 4 | ||||
-rw-r--r-- | lib/chef/formatters/error_descriptor.rb | 2 | ||||
-rw-r--r-- | lib/chef/formatters/error_inspectors/resource_failure_inspector.rb | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/formatters/base.rb b/lib/chef/formatters/base.rb index b2a8c8099b..2ac1274c37 100644 --- a/lib/chef/formatters/base.rb +++ b/lib/chef/formatters/base.rb @@ -51,8 +51,8 @@ class Chef #-- # TODO: is it too clever to be defining new() on a module like this? def self.new(name, out, err) - formatter_class = by_name(name.to_s) or - raise UnknownFormatter, "No output formatter found for #{name} (available: #{available_formatters.join(', ')})" + (formatter_class = by_name(name.to_s)) || + raise(UnknownFormatter, "No output formatter found for #{name} (available: #{available_formatters.join(', ')})") formatter_class.new(out, err) end diff --git a/lib/chef/formatters/error_descriptor.rb b/lib/chef/formatters/error_descriptor.rb index 0f14e6e783..1a40f785cb 100644 --- a/lib/chef/formatters/error_descriptor.rb +++ b/lib/chef/formatters/error_descriptor.rb @@ -31,7 +31,7 @@ class Chef end def section(heading, text) - @sections << { heading => (text or "") } + @sections << { heading => (text || "") } end def display(out) diff --git a/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb b/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb index f5936285be..94ecce88de 100644 --- a/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +++ b/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb @@ -63,7 +63,7 @@ class Chef def recipe_snippet return nil if dynamic_resource? @snippet ||= begin - if file = parse_source and line = parse_line(file) + if (file = parse_source) && (line = parse_line(file)) return nil unless ::File.exists?(file) lines = IO.readlines(file) |