No trailing if for multiline code

We prefer ‘if’ conditional block over a trailing ‘if’ for multiline code.

For code with single line adding if condition at the end is definitely preferred but for multiline code it makes it more readable and the developer does not have to read the whole block of code only to realize that its conditional.

Example 1

Condition on multiline Code:

#bad
def update
  return render json: {errors: "You can't to edit this directory"},
                status: :forbidden if @directory.master?
end

#preferred
def update
  if @directory.master?
    return render json: {errors: "You can't to edit this directory"},
                  status: :forbidden
  end
end

Example 2

Condition on block of code:

#bad
10.times do
  # multi-line body omitted
end if some_condition

#preferred
if some_condition
  10.times do
    # multi-line body omitted
  end
end