diff --git a/.rubocop.yml b/.rubocop.yml index dbf9532b5..c63b76e90 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -115,6 +115,9 @@ Layout/SpaceBeforeFirstArg: Layout/SpaceBeforeSemicolon: Enabled: true +Layout/SpaceInLambdaLiteral: + Enabled: true + Layout/SpaceInsideArrayLiteralBrackets: Enabled: true diff --git a/app/models/local_census_record.rb b/app/models/local_census_record.rb index a14a8fb92..71ead77a7 100644 --- a/app/models/local_census_record.rb +++ b/app/models/local_census_record.rb @@ -7,7 +7,7 @@ class LocalCensusRecord < ApplicationRecord validates :postal_code, presence: true validates :document_number, uniqueness: { scope: :document_type } - scope :search, -> (terms) { where("document_number ILIKE ?", "%#{terms}%") } + scope :search, ->(terms) { where("document_number ILIKE ?", "%#{terms}%") } private diff --git a/app/models/poll/partial_result.rb b/app/models/poll/partial_result.rb index d608044cc..02b6906b2 100644 --- a/app/models/poll/partial_result.rb +++ b/app/models/poll/partial_result.rb @@ -9,7 +9,7 @@ class Poll::PartialResult < ApplicationRecord validates :question, presence: true validates :author, presence: true validates :answer, presence: true - validates :answer, inclusion: { in: -> (a) { a.question.possible_answers }}, + validates :answer, inclusion: { in: ->(a) { a.question.possible_answers }}, unless: ->(a) { a.question.blank? } validates :origin, inclusion: { in: VALID_ORIGINS } diff --git a/app/models/poll/question/answer.rb b/app/models/poll/question/answer.rb index 91320743c..97a002752 100644 --- a/app/models/poll/question/answer.rb +++ b/app/models/poll/question/answer.rb @@ -15,7 +15,7 @@ class Poll::Question::Answer < ApplicationRecord validates_translation :title, presence: true validates :given_order, presence: true, uniqueness: { scope: :question_id } - scope :by_author, -> (author) { where(author: author) } + scope :by_author, ->(author) { where(author: author) } scope :visibles, -> { where(hidden: false) } diff --git a/app/models/user.rb b/app/models/user.rb index 73388580b..43927fe39 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -123,7 +123,7 @@ class User < ApplicationRecord string = "%#{search_string}%" where("username ILIKE ? OR email ILIKE ? OR document_number ILIKE ?", string, string, string) end - scope :between_ages, -> (from, to) do + scope :between_ages, ->(from, to) do where( "date_of_birth > ? AND date_of_birth < ?", to.years.ago.beginning_of_year, diff --git a/app/models/votation_set_answer.rb b/app/models/votation_set_answer.rb index c299881b3..7cc3a55cb 100644 --- a/app/models/votation_set_answer.rb +++ b/app/models/votation_set_answer.rb @@ -2,5 +2,5 @@ class VotationSetAnswer < ApplicationRecord belongs_to :votation_type belongs_to :author, -> { with_hidden }, class_name: "User", inverse_of: :votation_set_answers - scope :by_author, -> (author) { where(author: author) } + scope :by_author, ->(author) { where(author: author) } end