From c1ae23dd00efeec3e45ae4ca3e389203919d53ae Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Mon, 19 Sep 2016 09:59:57 -0700 Subject: [PATCH] Fix guard-clause warnings reported by RuboCop 0.43 --- features/support/vagrant_helpers.rb | 8 +++----- lib/capistrano/configuration/validated_variables.rb | 7 +++---- lib/capistrano/version_validator.rb | 7 ++----- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/features/support/vagrant_helpers.rb b/features/support/vagrant_helpers.rb index a42fdb23..1dbdf874 100644 --- a/features/support/vagrant_helpers.rb +++ b/features/support/vagrant_helpers.rb @@ -25,11 +25,9 @@ module VagrantHelpers end def run_vagrant_command(command) - if (status = vagrant_cli_command("ssh -c #{command.inspect}")).success? - true - else - raise VagrantSSHCommandError, status - end + status = vagrant_cli_command("ssh -c #{command.inspect}") + return true if status.success? + raise VagrantSSHCommandError, status end end diff --git a/lib/capistrano/configuration/validated_variables.rb b/lib/capistrano/configuration/validated_variables.rb index 7798fa31..6210e7d2 100644 --- a/lib/capistrano/configuration/validated_variables.rb +++ b/lib/capistrano/configuration/validated_variables.rb @@ -91,10 +91,9 @@ module Capistrano end def assert_value_or_block_not_both(value, block) - unless value.nil? || block.nil? - raise Capistrano::ValidationError, - "Value and block both passed to Configuration#set" - end + return if value.nil? || block.nil? + raise Capistrano::ValidationError, + "Value and block both passed to Configuration#set" end class ValidatedQuestion < Question diff --git a/lib/capistrano/version_validator.rb b/lib/capistrano/version_validator.rb index 0c9843f0..b3f6127a 100644 --- a/lib/capistrano/version_validator.rb +++ b/lib/capistrano/version_validator.rb @@ -5,11 +5,8 @@ module Capistrano end def verify - if match? - self - else - raise "Capfile locked at #{version}, but #{current_version} is loaded" - end + return self if match? + raise "Capfile locked at #{version}, but #{current_version} is loaded" end private