Add and apply EmptyLineAfterGuardClause rule
We were inconsistent on this one. I consider it particularly useful when a method starts with a `return` statement. In other cases, we probably shouldn't have a guard rule in the middle of a method in any case, but that's a different refactoring.
This commit is contained in:
@@ -63,6 +63,7 @@ class Poll::Question < ApplicationRecord
|
||||
|
||||
def self.answerable_by(user)
|
||||
return none if user.nil? || user.unverified?
|
||||
|
||||
where(poll_id: Poll.answerable_by(user).pluck(:id))
|
||||
end
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ class Poll::Question::Answer::Video < ApplicationRecord
|
||||
return if url.blank?
|
||||
return if url.match(VIMEO_REGEX)
|
||||
return if url.match(YOUTUBE_REGEX)
|
||||
|
||||
errors.add(:url, :invalid)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,6 +21,7 @@ class Poll::Recount < ApplicationRecord
|
||||
|
||||
[:white, :null, :total].each do |amount|
|
||||
next unless send("#{amount}_amount_changed?") && send("#{amount}_amount_was").present?
|
||||
|
||||
self["#{amount}_amount_log"] += ":#{send("#{amount}_amount_was")}"
|
||||
amounts_changed = true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user