Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules. Personally I prefer no empty lines around blocks, clases, etc... as recommended by the Ruby style guide [1], and they're the default values in rubocop, so those are the settings I'm applying. The exception is the `private` access modifier, since we were leaving empty lines around it most of the time. That's the default rubocop rule as well. Personally I don't have a strong preference about this one. [1] https://rubystyle.guide/#empty-lines-around-bodies
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
class Poll::Answer < ApplicationRecord
|
||||
|
||||
belongs_to :question, -> { with_hidden }
|
||||
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id"
|
||||
|
||||
|
||||
@@ -32,5 +32,4 @@ class Poll::Ballot < ApplicationRecord
|
||||
def not_already_added?(investment)
|
||||
ballot.lines.where(investment: investment).blank?
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -38,5 +38,4 @@ class Poll::BallotSheet < ApplicationRecord
|
||||
poll_ballot: poll_ballot,
|
||||
budget: poll.budget).first_or_create!
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -32,6 +32,5 @@ class Poll
|
||||
def todays_booths
|
||||
officer_assignments.by_date(Date.current).map(&:booth).uniq
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,6 +32,5 @@ class Poll
|
||||
def booth
|
||||
booth_assignment.booth
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Poll::PairAnswer < ApplicationRecord
|
||||
|
||||
belongs_to :question, -> { with_hidden }
|
||||
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id"
|
||||
belongs_to :answer_right, class_name: "Poll::Question::Answer", foreign_key: "answer_rigth_id"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Poll::PartialResult < ApplicationRecord
|
||||
|
||||
VALID_ORIGINS = %w[web booth]
|
||||
|
||||
belongs_to :question, -> { with_hidden }
|
||||
|
||||
@@ -97,5 +97,4 @@ class Poll::Question::Answer < ApplicationRecord
|
||||
is_most_voted = answers.none? { |a| a > total_votes }
|
||||
update!(most_voted: is_most_voted)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class Poll::Recount < ApplicationRecord
|
||||
|
||||
VALID_ORIGINS = %w[web booth letter].freeze
|
||||
|
||||
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id"
|
||||
|
||||
@@ -120,5 +120,4 @@ class Poll::Stats
|
||||
def stats_cache(key, &block)
|
||||
Rails.cache.fetch("polls_stats/#{poll.id}/#{key}/#{version}", &block)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class Poll
|
||||
class Voter < ApplicationRecord
|
||||
|
||||
VALID_ORIGINS = %w[web booth letter].freeze
|
||||
|
||||
belongs_to :poll
|
||||
@@ -69,6 +68,5 @@ class Poll
|
||||
now.year - dob.year - (now.month > dob.month || (now.month == dob.month && now.day >= dob.day) ? 0 : 1)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user